/usr/share/pyshared/networkx/generators/tests/test_line.py is in python-networkx 1.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #!/usr/bin/env python
"""line graph
----------
"""
import networkx as nx
from nose.tools import *
class TestGeneratorLine():
def test_line(self):
G=nx.star_graph(5)
L=nx.line_graph(G)
assert_true(nx.is_isomorphic(L,nx.complete_graph(5)))
G=nx.path_graph(5)
L=nx.line_graph(G)
assert_true(nx.is_isomorphic(L,nx.path_graph(4)))
G=nx.cycle_graph(5)
L=nx.line_graph(G)
assert_true(nx.is_isomorphic(L,G))
G=nx.DiGraph()
G.add_edges_from([(0,1),(0,2),(0,3)])
L=nx.line_graph(G)
assert_equal(L.adj, {})
G=nx.DiGraph()
G.add_edges_from([(0,1),(1,2),(2,3)])
L=nx.line_graph(G)
assert_equal(sorted(L.edges()), [((0, 1), (1, 2)), ((1, 2), (2, 3))])
|