/** * Reset any link created in the graph result in this tracker, effectively * creating a new graph, containing the spots but no edge. */ public void reset() { graph = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); final Iterator<Spot> it = spots.iterator(true); while (it.hasNext()) { graph.addVertex(it.next()); } }
/** * Reset any link created in the graph result in this tracker, effectively * creating a new graph, containing the spots but no edge. */ public void reset() { graph = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); final Iterator<Spot> it = spots.iterator(true); while (it.hasNext()) { graph.addVertex(it.next()); } }
public void reset() { graph = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); final Iterator<Spot> it = spots.iterator(true); while (it.hasNext()) { graph.addVertex(it.next()); } }
public void reset() { graph = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); final Iterator<Spot> it = spots.iterator(true); while (it.hasNext()) { graph.addVertex(it.next()); } }
graph.addVertex( spot );
graph.addVertex( spot );
public static void addConnectionToGraph(Connection connection, double connectionWeight, SimpleWeightedGraph<ConnectionPoint3D, DefaultWeightedEdge> graphToUpdate) { ConnectionPoint3D source = connection.getSourcePoint(); ConnectionPoint3D target = connection.getTargetPoint(); if (!source.epsilonEquals(target, 1.0e-3)) { graphToUpdate.addVertex(source); graphToUpdate.addVertex(target); DefaultWeightedEdge edge = new DefaultWeightedEdge(); graphToUpdate.addEdge(source, target, edge); graphToUpdate.setEdgeWeight(edge, connectionWeight); } }
@Override public boolean execute(int hashIndex, Set<WriteableImageOutput> itemSet) { for (final WriteableImageOutput item : itemSet) { if (!graph.containsVertex(item)) { graph.addVertex(item); } } final List<WriteableImageOutput> itemList = new ArrayList<WriteableImageOutput>(); itemList.addAll(itemSet); for (int i = 0; i < itemList.size(); i++) { final WriteableImageOutput itemA = itemList.get(i); for (int j = i + 1; j < itemList.size(); j++) { final WriteableImageOutput itemB = itemList.get(j); DefaultWeightedEdge edge = graph.getEdge(itemA, itemB); if (edge == null) { edge = graph.addEdge(itemA, itemB); graph.setEdgeWeight(edge, 1); } else { graph.setEdgeWeight(edge, graph.getEdgeWeight(edge) + 1); } } } return true; } });
final File filename = new File(String.format("/Users/jsh2/Data/ukbench/full/ukbench0%04d.jpg", i)); graph.addVertex(filename.toString());
final File filename = new File(String.format("/Users/jsh2/Data/ukbench/full/ukbench0%04d.jpg", i)); graph.addVertex(filename.toString());
protected WeightedGraph<Figure, DefaultWeightedEdge> extractNetwork(JCas jcas, Annotation range) { SimpleWeightedGraph<Figure, DefaultWeightedEdge> graph = new SimpleWeightedGraph<Figure, DefaultWeightedEdge>( DefaultWeightedEdge.class); for (Figure figure : JCasUtil.select(jcas, Figure.class)) { if (!graph.containsVertex(figure)) { graph.addVertex(figure); } } for (Scene scene : JCasUtil.select(jcas, Scene.class)) { List<Speaker> speakers = JCasUtil.selectCovered(Speaker.class, scene); for (Speaker s1 : speakers) { Figure gf1 = s1.getFigure(); if (gf1 != null) for (Speaker s2 : speakers) { Figure gf2 = s2.getFigure(); if (gf2 != null) if (graph.containsEdge(gf1, gf2)) { DefaultWeightedEdge edge = graph.getEdge(gf1, gf2); double w = graph.getEdgeWeight(edge); graph.setEdgeWeight(edge, w + 1.0); } else { if (gf1 != gf2) graph.addEdge(gf1, gf2); } } } ; } return graph; }
for ( final Spot spot : spots ) graph.addVertex( spot );
graph.addVertex( spot ); if ( null != previous )
graph.addVertex( spot ); if ( null != previous )