TrackModel() { this( new SimpleWeightedGraph< Spot, DefaultWeightedEdge >( DefaultWeightedEdge.class ) ); }
TrackModel() { this( new SimpleWeightedGraph< Spot, DefaultWeightedEdge >( DefaultWeightedEdge.class ) ); }
/** * Create a builder for this kind of graph. * * @param edgeSupplier the edge supplier * @param <V> the graph vertex type * @param <E> the graph edge type * @return a builder for this kind of graph */ public static <V, E> GraphBuilder<V, E, ? extends SimpleWeightedGraph<V, E>> createBuilder( Supplier<E> edgeSupplier) { return new GraphBuilder<>(new SimpleWeightedGraph<>(null, edgeSupplier)); }
/** * Create a builder for this kind of graph. * * @param edgeClass class on which to base factory for edges * @param <V> the graph vertex type * @param <E> the graph edge type * @return a builder for this kind of graph */ public static <V, E> GraphBuilder<V, E, ? extends SimpleWeightedGraph<V, E>> createBuilder( Class<? extends E> edgeClass) { return new GraphBuilder<>(new SimpleWeightedGraph<>(edgeClass)); }
public static SimpleWeightedGraph<ConnectionPoint3D, DefaultWeightedEdge> createGraphFromConnections(Iterable<Connection> connections) { SimpleWeightedGraph<ConnectionPoint3D, DefaultWeightedEdge> graph = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); addConnectionsToGraph(connections, graph); return graph; } }
/** * Removes all the tracks from this model. */ void clear() { setGraph( new SimpleWeightedGraph< Spot, DefaultWeightedEdge >( DefaultWeightedEdge.class ) ); }
/** * Removes all the tracks from this model. */ void clear() { setGraph( new SimpleWeightedGraph< Spot, DefaultWeightedEdge >( DefaultWeightedEdge.class ) ); }
/** * 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 = new SimpleWeightedGraph<>( DefaultWeightedEdge.class ); for ( final List< Spot > branch : branches )
graph = new SimpleWeightedGraph<>( DefaultWeightedEdge.class ); for ( final List< Spot > branch : branches )
/** * Returns the Gomory-Hu Tree as an actual tree (graph). Note that this tree is not necessarily * unique. The edge weights represent the flow values/cut weights. This method runs in $O(n)$ * time. * * @return Gomory-Hu Tree */ public SimpleWeightedGraph<V, DefaultWeightedEdge> getGomoryHuTree() { if (p == null) // Lazy invocation of the algorithm this.calculateGomoryHuTree(); // Compute the tree from scratch. Since we compute a new tree, the user is free to modify // this tree. SimpleWeightedGraph<V, DefaultWeightedEdge> gomoryHuTree = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); Graphs.addAllVertices(gomoryHuTree, vertexList); for (int i = 1; i < N; i++) { Graphs.addEdge(gomoryHuTree, vertexList.get(i), vertexList.get(p[i]), fl[i]); } return gomoryHuTree; }
public static SimpleWeightedGraph<ConnectionPoint3D, DefaultWeightedEdge> createGlobalVisibilityGraph(Collection<VisibilityMapHolder> allVisibilityMapHolders) { SimpleWeightedGraph<ConnectionPoint3D, DefaultWeightedEdge> globalVisMap = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); for (VisibilityMapHolder visibilityMapHolder : allVisibilityMapHolders) { VisibilityMap visibilityMap = visibilityMapHolder.getVisibilityMapInWorld(); for (Connection connection : visibilityMap) addConnectionToGraph(connection, visibilityMapHolder.getConnectionWeight(connection), globalVisMap); } return globalVisMap; }
/** * Returns the Equivalent Flow Tree as an actual tree (graph). Note that this tree is not * necessarily unique. The edge weights represent the flow values/cut weights. This method runs * in $O(n)$ time * * @return Equivalent Flow Tree */ public SimpleWeightedGraph<V, DefaultWeightedEdge> getEquivalentFlowTree() { if (p == null) // Lazy invocation of the algorithm this.calculateEquivalentFlowTree(); SimpleWeightedGraph<V, DefaultWeightedEdge> equivalentFlowTree = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); Graphs.addAllVertices(equivalentFlowTree, vertexList); for (int i = 1; i < N; i++) { DefaultWeightedEdge e = equivalentFlowTree.addEdge(vertexList.get(i), vertexList.get(neighbors[i])); equivalentFlowTree.setEdgeWeight(e, flowMatrix[i][neighbors[i]]); } return equivalentFlowTree; }
System.out.println("done"); final SimpleWeightedGraph<String, DefaultWeightedEdge> graph = new SimpleWeightedGraph<String, DefaultWeightedEdge>( DefaultWeightedEdge.class);
WeightedGraph<TypeA, DefaultWeightedEdge> graph = new SimpleWeightedGraph<>(DefaultWeightedEdge.class); Set<TypeA> partition1 = new HashSet<>(); Set<TypeA> partition2 = new HashSet<>();
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; }
model.setSpots( sc, false ); final SimpleWeightedGraph< Spot, DefaultWeightedEdge > graph = new SimpleWeightedGraph< >( DefaultWeightedEdge.class ); for ( final Spot spot : spots )