Skip to content

[BUG] typeError exception in tree_layout() when Plottable created with cudf dataframes #640

Open
@DataBoyTX

Description

@DataBoyTX

Describe the bug

If you create a graph from cudf dataframes and call tree_layout a TypeError exception is raised.

To Reproduce

edges_sample.csv
nodes_sample.csv

import graphistry
import pandas as pd
import os 
import cudf

graphistry.register(api=3,  
                    protocol  = "http", 
                    server    = os.getenv("GRAPHISTRY_SERVER"),
                    username  = os.getenv("GRAPHISTRY_USERNAME"),         
                    password  = os.getenv("GRAPHISTRY_PASSWORD"))


ncdf = cudf.read_csv("nodes_sample.csv")
ecdf = cudf.read_csv("edges_sample.csv")


g = graphistry.nodes(ncdf, "job_name").edges(ecdf, "source", "destination") 

g.tree_layout().plot()

Expected behavior
tree_layout should run or return a better error if cudf dataframes are not supported

Actual behavior

above code results in:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[7], line 19
     14 ecdf = cudf.read_csv("edges_sample.csv")
     17 g = graphistry.nodes(ncdf, "job_name").edges(ecdf, "source", "destination") 
---> 19 g.tree_layout().plot()

File /opt/conda/lib/python3.10/site-packages/graphistry/layouts.py:106, in LayoutsMixin.tree_layout(self, level_col, level_sort_values_by, level_sort_values_by_ascending, width, height, rotate, allow_cycles, root, *args, **kwargs)
    103     if SugiyamaLayout.has_cycles(g._edges, source_column = g2._source, target_column = g2._destination):
    104         raise ValueError
--> 106 triples = SugiyamaLayout.arrange(g2._edges, topological_coordinates = True, source_column = g2._source, target_column = g2._destination, include_levels = True, root = root)
    107 g2._nodes[level_col] = [triples[id][2] for id in g2._nodes[g2._node]]
    108 g2._nodes[y_col] = [triples[id][1] * height for id in g2._nodes[g2._node]]

File /opt/conda/lib/python3.10/site-packages/graphistry/layout/sugiyama/sugiyamaLayout.py:188, in SugiyamaLayout.arrange(obj, iteration_count, source_column, target_column, layout_direction, topological_coordinates, root, include_levels)
    186     gg = obj
    187 else:
--> 188     raise TypeError
    190 for v in gg.vertices():
    191     v.view = Rectangle()

TypeError: 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions