Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the same edge to the vertex overwrites the previous one even if the other vertex is different #1125

Open
fabianmurariu opened this issue Sep 3, 2022 · 2 comments

Comments

@fabianmurariu
Copy link

 * JGraphT version: 1.5.1
 * Java version (java -version)/platform:
openjdk version "17.0.4.1" 2022-08-12
OpenJDK Runtime Environment (Red_Hat-17.0.4.1.1-2.fc38) (build 17.0.4.1+1)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.4.1.1-2.fc38) (build 17.0.4.1+1, mixed mode, sharing)  

Is there any graph kind supported by JGraphT that pass this test?

import scala.jdk.CollectionConverters._

class JGraphTSuite extends munit.FunSuite{
test("does not overwrite edges"){
    val g = new DefaultUndirectedGraph[Int, String](classOf[String])

    g.addVertex(1)
    g.addVertex(2)
    g.addVertex(3)
    g.addVertex(4)


    g.addEdge(2, 1, "one")
    g.addEdge(2, 3, "one")
    g.addEdge(2, 4, "one")

    val neighbours = Graphs.neighborSetOf(g, 2).asScala.toSet

    assertEquals(neighbours, Set(1, 3, 4)) // this fails
 }
}
@fabianmurariu
Copy link
Author

I'll add this #437 as a reference since it was commented on 10 days ago

@jsichi
Copy link
Member

jsichi commented Sep 4, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants