dataToStatements function

List<Statement> dataToStatements(
  1. Map<String, List<String>> data,
  2. EdgeOp opType
)

Implementation

List<Statement> dataToStatements(Map<String, List<String>> data, EdgeOp opType) {
  final statements = <Statement>[];

  for (final node in data.keys) {
    statements.add(NodeStatement(NodeId(node)));
  }

  for (final mapping in data.entries) {
    final start = NodeId(mapping.key);
    for (final end in mapping.value) {
      statements.add(
        EdgeStatement(
          start,
          EdgeRhs(
            opType,
            NodeId(end),
          ),
        ),
      );
    }
  }

  return statements;
}