Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DataBoyTX opened this issue Jan 22, 2025 · 0 comments

Comments

@DataBoyTX
Copy link
Contributor

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: 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants