def test_single_node(self): # Is this really the intended behavior for providing a # single node as the argument `nodes`? Shouldn't the function # just return the connectivity value itself? G = nx.trivial_graph() conn = nx.builtin.average_degree_connectivity(G) assert conn == {0: 0}
def test_empty_list(self): """Tests that the empty list is not a valid path, since there should be a one-to-one correspondence between paths as lists of nodes and paths as lists of edges. """ G = nx.trivial_graph() assert not nx.builtin.is_simple_path(G, [])
def test_trivial_graph(self): """Tests that the trivial graph has average path length zero, since there is exactly one path of length zero in the trivial graph. For more information, see issue #1960. """ G = nx.trivial_graph() assert nx.average_shortest_path_length(G) == 0
def test_single_node(self): G = nx.trivial_graph() p = nx.builtin.voterank(G) assert p == []
def test_trivial_nonpath(self): """Tests that a list whose sole element is an object not in the graph is not considered a simple path. """ G = nx.trivial_graph() assert not nx.builtin.is_simple_path(G, ["not a node"])
def test_trivial_path(self): """Tests that the trivial path, a path of length one, is considered a simple path in a graph. """ G = nx.trivial_graph() assert nx.builtin.is_simple_path(G, [0])