Method: NetworkX::Graph#edge?

Defined in:
lib/networkx/graph.rb

#edge?(node1, node2) ⇒ Boolean Also known as: has_edge?

Checks if the the edge consisting of two nodes is present in the graph

Examples:

graph.edge?(node1, node2)

Parameters:

  • node1 (Object)

    the first node of the edge to be checked

  • node2 (Object)

    the second node of the edge to be checked

Returns:

  • (Boolean)


295
296
297
# File 'lib/networkx/graph.rb', line 295

def edge?(node1, node2)
  node?(node1) && @adj[node1].has_key?(node2)
end