AbstractNode destNode = treeStructure.getNodeAt(target);
AbstractEdge edge;
if (ELEMENT_EDGES_PROPER.equalsIgnoreCase(name)) {
edge = new ProperEdgeImpl(id, srcNode, destNode);
} else if (ELEMENT_EDGES_MIXED.equalsIgnoreCase(name)) {
edge = new MixedEdgeImpl(id, srcNode, destNode, directed);
} else {
edge = new SelfLoopImpl(id, srcNode);
}
edge.setWeight(weight);
edge.getEdgeData().setAttributes(factory.newEdgeAttributes(edge.getEdgeData()));