public static String format(Link link) { Map<String, Object> map = new HashMap<String, Object>(); map.put("type", link.type()); map.put("label", link.label()); map.put("pair", link.pair().label()); if (link.factory().contains(GraphFactory.Family.directed)) { map.put("reverse", link.reverse().label()); } if (link.factory().contains(GraphFactory.Family.fractal)) { map.put("inverse", link.inverse().label()); map.put("down", link.down()); } return format(map); }