Solve problem on 79 Project Euler. This is a Graph problem in disguise, so the key is to figure out what is node and what is an edge. In other words, what are the things that have relationships in this problem and what defines their relationships? Once you figure that out, you can use topological sort to solve the problem. Create an account on the site to confirm your answer. You can do this in any language, but a key to solving the problem is finding the indegree of each node. The indegree of a node in a directed graph is the number of edges that have that node as a destination,1 or the number of edges that lead into the node. JUNG has a built in method for graphs to do this. The other thing to keep in mind for JUNG is that you can’t make two edges with the same value. So if you’re using a String to represent edges, you can’t have two edges with the value of "A".
Solve problem on 79 Project Euler. This is a Graph problem in disguise, so the key is to figure out what is node and what is an edge. In other words, what are the things that have relationships in this problem and what defines their relationships?
Once you figure that out, you can use topological sort to solve the problem. Create an account on the site to confirm your answer.
You can do this in any language, but a key to solving the problem is finding the indegree of each node. The indegree of a node in a directed graph is the number of edges that have that node as a destination,1 or the number of edges that lead into the node. JUNG has a built in method for graphs to do this.
The other thing to keep in mind for JUNG is that you can’t make two edges with the same value. So if you’re using a String to represent edges, you can’t have two edges with the value of "A".
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images