Exemple #1
0
 def test_edges_with_data_equal(self):
     G = nx.MultiGraph()
     nx.add_path(G, [0, 1, 2], weight=1)
     H = nx.MultiGraph()
     nx.add_path(H, [0, 1, 2], weight=1)
     self._test_equal(G.edges(data=True, keys=True),
                      H.edges(data=True, keys=True))
Exemple #2
0
 def setup_class(cls):
     # a tree
     G = nx.Graph()
     nx.add_path(G, [0, 1, 2, 3, 4, 5, 6])
     nx.add_path(G, [2, 7, 8, 9, 10])
     cls.G = G
     # a disconnected graph
     D = nx.Graph()
     D.add_edges_from([(0, 1), (2, 3)])
     nx.add_path(D, [2, 7, 8, 9, 10])
     cls.D = D
Exemple #3
0
 def setup_method(self):
     # a tree
     G = nx.Graph()
     nx.add_path(G, [0, 1, 2, 3, 4, 5, 6])
     nx.add_path(G, [2, 7, 8, 9, 10])
     self.G = G
     # a disconnected graph
     D = nx.Graph()
     D.add_edges_from([(0, 1), (2, 3)])
     nx.add_path(D, [2, 7, 8, 9, 10])
     self.D = D
Exemple #4
0
 def test_graphs_not_equal3(self):
     G = nx.path_graph(4)
     H = nx.Graph()
     nx.add_path(H, range(4))
     H.name = "path_graph(4)"
     self._test_not_equal(G, H)
Exemple #5
0
 def test_graphs_not_equal2(self):
     G = nx.path_graph(4)
     H = nx.Graph()
     nx.add_path(H, range(3))
     self._test_not_equal(G, H)
Exemple #6
0
 def test_multidigraphs_equal(self):
     G = nx.path_graph(4, create_using=nx.MultiDiGraph())
     H = nx.MultiDiGraph()
     nx.add_path(H, range(4))
     self._test_equal(G, H)
def test_path():
    G = nx.DiGraph()
    nx.add_path(G, range(5))
    assert nx.is_branching(G)
    assert nx.is_arborescence(G)