Skip to content

Add a function that parses a map of nodes and rel into a graph object  #441

Open
@matea16

Description

@matea16

Currently, in order to pass an object as a subgraph argument to a procedure, it has to be a Graph type object which is only provided by the output of the project() function.

For the usability purposes, it would be useful to have a function that takes map of nodes and edges as an argument and parses them into a Graph type of object. For example, the following query works as expected:

MATCH p=(:Node)-[:RELATION]-(:Node)
WITH project(p) AS subgraph
CALL bridges.get(subgraph)
YIELD node_from, node_to
RETURN node_from, node_to;

but, the you can not pass the subgraph as an argument using this query:

CALL {
  MATCH (n:Node)
  RETURN n
  LIMIT 1
}
CALL path.subgraph_all(n, {}) YIELD nodes, rels
WITH {nodes: nodes, edges: rels} AS subgraph
CALL bridges.get(subgraph)
YIELD node_from, node_to
RETURN node_from, node_to;

Source from the community

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions