Cyclic Reingold-Tilford tree-like layout

Trying to get a Reingold-Tilford view of a graph with cycles. There are many many nodes. If they must be removed to establish topoligical order for a Reingold-Tilford plot, is there a way to search through iGraph to do this.

If they do not need to be removed, how do I get past the error:

igraph._igraph.InternalError: Error at src/properties/dag.c:114: The graph has cycles; topological sorting is only possible in acyclic graphs. -- Invalid value

I have tried all other layouts(Large graph, Distributed Recursive Layout, fruchterman reingold, ect.), but the amount of data always results in seeming galaxy clusters, where edges and nodes cannot be made out as they overlap.

I know the top. I also know all end nodes, but they is a many differing types of cycles, from singular nodes, to longer orbits.

This layout method is specifically for trees, i.e. graphs without undirected cycles. Can you explain why you insist on using this method for a graph that is not a tree?

I find this error a bit unusual, as the point is that the graph should be a tree, not that it should be a DAG. I will look into this.

Part of it was not setting root, but the topology is still too complex for Reingold-Tilford. Although, I guess without root, it should default. Setting root as follows:

import os
import igraph as ig
import pandas as pd


os.chdir("C:/Users/bizo2/Desktop")

df = pd.read_excel("edgelist3.xlsx")
g = ig.Graph.DataFrame(df)
visual_style = {}
visual_style["vertex_size"] = 30

visual_style["vertex_label"] = g.vs["name"]
layout = g.layout_reingold_tilford(mode="all", root=[3,6,10,14,18,22,26,30,33,36,40,43,46,49,52,55,58,62,65,69,72,76,79,81,85,89,93,97,100,103,107,110,114,117,120,123,126,129,132,135,139,142,145,147,151,154,157,160,164,167,171,175,179,183,186,190,193,197,201,205,208,211,214,217,221,224,227,230,234,237,240,244,248,252,255,259,262,265,268,272,275,278,281,284,287,291,295,298,302,306,309,313,317,321,324,327,331,334,338,342,345,348,351,354,357,361,365,369,373,376,380,384,387,391,394,397,401,405,409,412,416,419,422,426,430,433,437])
layout = g.layout("rt")
visual_style["layout"] = layout

visual_style["bbox"] = (50000,50000)

ig.plot(g, **visual_style)

gives

  File "<stdin>", line 1, in <module>
  File "C:\Users\bizo2\anaconda3\envs\myenv\lib\site-packages\igraph\__init__.py", line 1697, in layout
    layout = method(self, *args, **kwds)
  File "C:\Users\bizo2\anaconda3\envs\myenv\lib\site-packages\igraph\__init__.py", line 5122, in result
    layout = func(*args, **kwds)
igraph._igraph.InternalError: Error at src/properties/dag.c:114: The graph has cycles; topological sorting is only possible in acyclic graphs. -- Invalid value

Can I force acyclic? With ‘mode=out’ or something?

cairo also seems to fail

  File "<stdin>", line 1, in <module>
  File "C:\Users\bizo2\anaconda3\envs\myenv\lib\site-packages\igraph\drawing\__init__.py", line 481, in plot
    result = Plot(target, bbox, background=kwds.get("background", "white"))
  File "C:\Users\bizo2\anaconda3\envs\myenv\lib\site-packages\igraph\drawing\__init__.py", line 144, in __init__
    self._surface = cairo.ImageSurface(
cairo.Error: invalid value (typically too big) for the size of the input (surface, pattern, etc.)

As I said above, using this layout makes no sense unless the graph is a tree.

This is a tree of sorts, just a highly complex tree with cycles. I was able to force output with ‘.svg’. If I may play around, and instead of some of the many to many, many to one, or one to many relations, instantiate variants of edge calls by modify the vertex names, to uphold a more one to one fashion.
ex.
A->B
C->B
becomes
A->B1
C->B2

If your graph is almost a tree, i.e. it only has very few undirected cycles, then this plotting method may indeed be useful. In the current version, if you set the root (or multiple roots) manually, then plotting will be possible.

I will improve this for future versions so that automatic root selection will work even for directed graphs that have some cycles. Keep in mind that the output may not be very informative.

I think that the Reingold-Tilford method is not very good even for directed acyclic graphs that are not trees (when viewed as undirected). If you have such graphs, I suggest trying the Sugiyama method.

This works, on behalf of my organization, I would like to thank you very much.