MCPcopy Index your code
hub / github.com/networkx/networkx / nodes_equal

Function nodes_equal

networkx/utils/misc.py:515–539  ·  view source on GitHub ↗

Check if nodes are equal. Equality here means equal as Python objects. Node data must match if included. The order of nodes is not relevant. Parameters ---------- nodes1, nodes2 : iterables of nodes, or (node, datadict) tuples Returns ------- bool True

(nodes1, nodes2)

Source from the content-addressed store, hash-verified

513
514
515def nodes_equal(nodes1, nodes2):
516 """Check if nodes are equal.
517
518 Equality here means equal as Python objects.
519 Node data must match if included.
520 The order of nodes is not relevant.
521
522 Parameters
523 ----------
524 nodes1, nodes2 : iterables of nodes, or (node, datadict) tuples
525
526 Returns
527 -------
528 bool
529 True if nodes are equal, False otherwise.
530 """
531 nlist1 = list(nodes1)
532 nlist2 = list(nodes2)
533 try:
534 d1 = dict(nlist1)
535 d2 = dict(nlist2)
536 except (ValueError, TypeError):
537 d1 = dict.fromkeys(nlist1)
538 d2 = dict.fromkeys(nlist2)
539 return d1 == d2
540
541
542def edges_equal(edges1, edges2, *, directed=False):

Callers 15

test_nodesMethod · 0.90
test_add_starMethod · 0.90
test_add_pathMethod · 0.90
test_add_cycleMethod · 0.90
test_selfloopsFunction · 0.90
test_pickleMethod · 0.90
test_edges_nbunchMethod · 0.90
test_subgraphMethod · 0.90
test_reverse_hashableMethod · 0.90
test_nbunch_iterMethod · 0.90
test_selfloopsMethod · 0.90

Calls

no outgoing calls

Tested by 15

test_nodesMethod · 0.72
test_add_starMethod · 0.72
test_add_pathMethod · 0.72
test_add_cycleMethod · 0.72
test_selfloopsFunction · 0.72
test_pickleMethod · 0.72
test_edges_nbunchMethod · 0.72
test_subgraphMethod · 0.72
test_reverse_hashableMethod · 0.72
test_nbunch_iterMethod · 0.72
test_selfloopsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…