Skip to content

Commit

Permalink
Merge 4192518 into 7565dc3
Browse files Browse the repository at this point in the history
  • Loading branch information
jnke2016 authored Aug 17, 2021
2 parents 7565dc3 + 4192518 commit eaef0c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions python/cugraph/layout/force_atlas2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# limitations under the License.

from cugraph.layout import force_atlas2_wrapper
import cugraph


def force_atlas2(
Expand Down Expand Up @@ -106,6 +107,7 @@ def on_train_end(self, positions):
GPU data frame of size V containing three columns:
the vertex identifiers and the x and y positions.
"""
input_graph, isNx = cugraph.utilities.check_nx_graph(input_graph)

if pos_list is not None:
if input_graph.renumbered is True:
Expand Down
10 changes: 9 additions & 1 deletion python/cugraph/utilities/nx_factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020, NVIDIA CORPORATION.
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -14,6 +14,7 @@
import cugraph
from .utils import import_optional
from cudf import from_pandas
import numpy as np

nx = import_optional("networkx")

Expand All @@ -35,6 +36,13 @@ def convert_from_nx(nxG, weight=None):
raise ValueError("nxG does not appear to be a NetworkX graph type")

pdf = nx.to_pandas_edgelist(nxG)
# Convert vertex columns to strings if they are not integers
# This allows support for any vertex input type
if pdf["source"].dtype not in [np.int32, np.int64] or \
pdf["target"].dtype not in [np.int32, np.int64]:
pdf['source'] = pdf['source'].astype(str)
pdf['target'] = pdf['target'].astype(str)

num_col = len(pdf.columns)

if num_col < 2:
Expand Down

0 comments on commit eaef0c0

Please sign in to comment.