Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
For a java program, the input file is a matrix. Java program will do read the input file and then do some things.
Each line of the file contains row number, column number, the weight of the edge between two nodes.
such as:
1,1,0
1,2,-1
1,3,2
...
Self-loop is equal zero, and if there is no edge between two nodes, it should be infinite (∞).
How can I set infinite in the input file?

What I have tried:

Setting infinite value (∞) in the input file and reading it in java
Posted
Updated 26-Aug-17 23:17pm
v2

1 solution

There is no such value that you can insert as a number: that is the nature of "infinite values".
Instead, I'd write something that wasn't a number at all - a character like 'i' or even '∞' if your file is Unicode and specifically check for that when I read the file back while converting the values back to numbers.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900