javamavenintellij-ideajgraphtunion-find

How do I import UnionFind<T> to IntelliJ? (Java)


I want to import this UnionFind- class to my IntelliJ project. But I get a Maven error I do not understand. When I try and type import org.jgrapht.alg.util.UnionFind<T>; in the beginning of my project, I get an error saying

Cannot resolve symbol 'jgrapht'

I get the option to add Maven dependency..., but when I click on it this

this

window pops up. I don't know what Maven is, and I am scared to alter anything whn I don't know how it works.


Solution

  • Try to import the dependency in your pom.xml file

    <dependency>
        <groupId>org.jgrapht</groupId>
        <artifactId>jgrapht-core</artifactId>
        <version>1.5.1</version>
    </dependency>
    
    

    Maven Repository

    UnionFind class is in this dependency.