public override void SerializeReferences(GraphSerializationContext ctx) { if (connections == null) { ctx.writer.Write(-1); } else { ctx.writer.Write(connections.Length); for (int i = 0; i < connections.Length; i++) { ctx.writer.Write(ctx.GetNodeIdentifier(connections[i])); ctx.writer.Write(connectionCosts[i]); } } }