}
mxMultiplicity[] multiplicities = new mxMultiplicity[3];
// Source nodes needs 1..2 connected Targets
multiplicities[0] = new mxMultiplicity(true, "Source", null, null, 1,
"2", Arrays.asList(new String[] { "Target" }),
"Source Must Have 1 or 2 Targets",
"Source Must Connect to Target", true);
// Source node does not want any incoming connections
multiplicities[1] = new mxMultiplicity(false, "Source", null, null, 0,
"0", null, "Source Must Have No Incoming Edge", null, true); // Type does not matter
// Target needs exactly one incoming connection from Source
multiplicities[2] = new mxMultiplicity(false, "Target", null, null, 1,
"1", Arrays.asList(new String[] { "Source" }),
"Target Must Have 1 Source", "Target Must Connect From Source",
true);
graph.setMultiplicities(multiplicities);