Correctness of networkx line digraph construction -


the following python code:

import networkx nx g = nx.digraph() g.add_nodes_from([0, 1]) g.add_edges_from([(0,0), (0,1), (1,0), (1,1)]) nx.write_dot(g, 'g.dot') gl = nx.line_graph(g) nx.write_dot(gl, 'gl.dot') 

creates following dot format graphs:

--- g.dot ---

digraph  {     0 -> 0;     0 -> 1;     1 -> 0;     1 -> 1; }    

--- gl.dot ---

strict digraph  {     "(0, 1)" -> "(1, 1)";     "(1, 0)" -> "(0, 0)";     "(0, 0)" -> "(0, 1)";     "(1, 1)" -> "(1, 0)"; }    

should edges:

"(1, 0)" -> "(0, 1)"; "(0, 1)" -> "(1, 0)"; "(0, 0)" -> "(1, 1)"; "(1, 1)" -> "(0, 0)"; 

be in line graph construction?

http://en.wikipedia.org/wiki/line_graph#line_digraph

nx.line_graph creates strict digraph. strict means there no loops , no repeated edges. "(0, 1)" -> "(1, 0)" loop, not included. in other words, "two vertices representing directed edges u v , w x in g connected edge uv wx in strict line digraph when v = w and u != x". (quote wikipedia - insertions bold).


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -