BiconnectivityInspector bug
See original GitHub issue * JGraphT version: 1.2.0
* Java version (java -version)/platform: java-8-openjdk
Issue Bug in Biconnected Components Algorithm (BiconnectivityInspector.java)
Steps to reproduce (small coding example) (Simple scala code)
import java.util.function.Supplier
import org.jgrapht.graph.{DefaultEdge, SimpleDirectedGraph}
import org.jgrapht.util.SupplierUtil
import org.jgrapht.alg.connectivity.BiconnectivityInspector
import scala.collection.JavaConverters._
object bb {
class IntSupplier (var id: Int = -1) extends Supplier[Int] {
def get(): Int = {
id += 1
id
}
}
def main(args: Array[String]): Unit = {
val g = new SimpleDirectedGraph[Int, DefaultEdge](new IntSupplier(), SupplierUtil.DEFAULT_EDGE_SUPPLIER, false)
val vertices = List(0, 1, 2, 3, 4)
val edges = List((0,1), (4,0), (1,4), (4,2), (4,3), (1, 3))
for(v <- vertices){
g.addVertex(v)
}
for(e <- edges){
g.addEdge(e._1, e._2)
}
//println(g.edgeSet())
val bi = new BiconnectivityInspector(g)
val nbic = bi.getBlocks()
for(cc <- nbic.asScala){
println(cc.vertexSet())
}
}
}
outputs:
[1, 2, 3, 4]
[0, 1, 4]
Expected behaviour Crearly in the input graph (undirected version of it), the biconnected components are (0, 1, 3, 4) and (2, 4).
Other information Interestingly, if the same graph is constructed as undirected from the beginning, the algorithm works properly, so maybe the problem is related to the class AsUndirectedGraph.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
org._3pq.jgrapht.alg.ConnectivityInspector java code examples ...
BiconnectivityInspector.lazyFindBiconnectedSets(). biconnectedSets = new ArrayList(); Iterator connectedSets = new ConnectivityInspector(graph).
Read more >BiconnectivityInspector (JGraphT : a free Java graph library)
Returns the biconnected vertex-components containing the vertex. A biconnected vertex-component contains all the vertices in the component.
Read more >IteratingSDFReader (cdk 2.5 API)
If true the reader will fetch the next molecule. Parameters: skip - ignore error molecules continue reading ...
Read more >BasicAlarmEvent (ignition 7.9.0-beta1 API)
... BellmanFordShortestPath · BetterDataInputStream · BetterWidthScrollPaneLayout · BiconnectivityInspector · BifurcatingOutputStream · BinaryAppender ...
Read more >The CDK Changelog - Chemistry Development Kit
... use with jgrapht) * Added some graph algorithms (BiconnectivityInspector, ... This fixes Bug #736137 "small problem in layout managers" * Added missing ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jkinable yes, it does fix our issue as well, thanks for asking!
@mightynull we merged the bug fix committed by @gilcu3. Could you test whether this also fixes the issue on your end, just to be certain that there are no additional hidden bugs?