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.

ArgumentException in UndirectedEdge constructor

See original GitHub issue

I’m probably missing something in the inner workings of the library, but I can’t understand why there is the need to make sure that Source is “lower” (whatever that might mean, since we are working on arbitrary structures) than Target when constructing a new UndirectedEdge (and in fact there are specialized edge comparers that test if source == source && target == target OR source == target && target == source).

Would it work if I were to implement a CompareTo function that always returns 0?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SirePicommented, Jul 10, 2021

Personally, I find it more disturbing to have to be careful about order in an undirected edge (and, even more disturbing, having Source and Target properties in an undirected structure), but that’s my problem 😄

I understand it comes from the need to have a common structure between all edge types so, it’s all good for me.

In any case I’ve already sorted it out (pun intended) on my side by using a static method that compares the two vertices and calls the constructor with parameters in the right order.

0reactions
KeRNeLithcommented, Jul 10, 2021

Glad to hear you find a way to make it working on your end 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edge of undirected graph in Java
Suppose I am writing a Java class to represent an edge of undirected graph. This class Edge contains two vertices to and from...
Read more >
Undirected graph data structure in C# - ...
and since V doesn't change after being set in the constructor, ... Length)) throw new ArgumentException("Invalid node number specified.
Read more >
ArgumentException Constructor (System)
Initializes a new instance of the ArgumentException class with a specified error message, the parameter name, and a reference to the inner exception...
Read more >
In this assignment, you will add functionality to the Graph ...
Add a constructor UndirectedGraph() that reads in a File object for a ... Illegal ArgumentException: Cannot add directed edge to undirected graph 12:06...
Read more >
Class AsUndirectedGraph<V,E>
An undirected view of the backing directed graph specified in the constructor. This graph allows modules to apply algorithms designed for undirected graphs ......
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