redisgraph v0.1.0 RedisGraph.Edge View Source

An Edge component relating two Nodes in a Graph.

Edges must have a source node and destination node, describing a relationship between two entities in a Graph. The nodes must exist in the Graph in order for the edge to be added.

Edges must have a relation which identifies the type of relationship being described between entities

Edges, like Nodes, may also have properties, a map of values which describe attributes of the relationship between the associated Nodes.

Link to this section Summary

Functions

Compare two edges with respect to equality.

Create a new Edge from a map.

Convert an edge's properties to a query-appropriate string.

Convert an edge to a query-appropriate string.

Link to this section Types

Link to this type

t()

View Source
t() :: %RedisGraph.Edge{
  dest_node: Node.t() | number(),
  id: integer(),
  properties: %{optional(String.t()) => any()},
  relation: String.t(),
  src_node: Node.t() | number()
}

Link to this section Functions

Link to this function

compare(left, right)

View Source
compare(t(), t()) :: boolean()

Compare two edges with respect to equality.

Comparison logic:

  • If the ids differ, returns false
  • If the source nodes differ, returns false
  • If the destination nodes differ, returns false
  • If the relations differ, returns false
  • If the properties differ, returns false
  • Otherwise returns true

Create a new Edge from a map.

Example

edge = Edge.new(%{
  src_node: john,
  dest_node: japan,
  relation: "visited"
})
Link to this function

properties_to_string(edge)

View Source
properties_to_string(t()) :: String.t()

Convert an edge's properties to a query-appropriate string.

Link to this function

to_query_string(edge)

View Source
to_query_string(t()) :: String.t()

Convert an edge to a query-appropriate string.