question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mightynullcommented, Sep 18, 2019

@jkinable yes, it does fix our issue as well, thanks for asking!

0reactions
jkinablecommented, Sep 13, 2019

@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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found