Skip to content

Get a dataframe of nodeId and nodeLabel in absence of any other node properties #666

@Hossein-Tohidi

Description

@Hossein-Tohidi

Looking for a function that generates a dataframe consisting of nodeId and nodeLabel
When the graph does not have any node attributes (just nodeId and nodeLabels are present), I cannot find a way to get the nodeLabels back. The nodeProperties.stream returns an empty dataframe. (This is working fine when we do have any node properties).

nodes_df = gds.graph.nodeProperties.stream(G, list(node_props), listNodeLabels=True)

Additionally, G.node_labels() only produces a list of labels without mapping them to the corresponding nodeIds. I checked the G._graph_info dictionary as well, but the map does not seem to be stored there.

For edges, we have gds.graph.relationships.stream and gds.graph.relationshipProperties.stream, which support retrieving edges with or without properties. However, I couldn't find similar functionalities for nodes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions