EdgeStatement.create constructor

EdgeStatement.create({
  1. required String from,
  2. required String to,
  3. EdgeOp opType = EdgeOp.directed,
  4. Map<String, String>? attributes,
})

Create an edge statement joining from and to, with an optional mapping of attributes by name to value.

You may need to specify opType if you are in an undirected graph.

Implementation

factory EdgeStatement.create({
  required String from,
  required String to,
  EdgeOp opType = EdgeOp.directed,
  Map<String, String>? attributes,
}) {
  AttrList? attrList;
  if (attributes != null) {
    attrList = AttrList([AList(attributes)]);
  }

  return EdgeStatement(
    NodeId(from),
    EdgeRhs(
      opType,
      NodeId(to),
    ),
    attrList,
  );
}