katpap17 / csr

CompressedSparseRows and BFS implementation using java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AreTheyFriends

AreTheyFriends is an app for asking "friendship" questions in social networks. It reads social networks in graph form and converts to [compressed-sparse-rows](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format).

Compilation

Compile using:

javac SourceAndTarget.java CompressedSparseRows.java BFS.java CsrTester.java

Execution

Execute using:

java CsrTester

Program will ask for a file path:

Welcome to AreTheyFriends! Please enter a file path:

Program accepts text files (.txt):

myfile.txt

Program will then make a csr:

Making CSR...

When the csr creation is complete, the user can choose what to do:

CSR created! What do you want to do?
a: Find out a node's neighbors
b: Find out if two nodes are connected and how long tha path between them is
c: Exit program

Option a

Enter a node number:

Option b

Enter starting node number:
Enter end node number:

Option c

Program exited succesfully

Output

Option a

Node 0 is connected to node 1.
Node 0 is connected to node 2.
Node 0 is connected to node 3.
Node 0 is connected to no nodes

Option b

The path exists and the nodes are connected through 1 vertices
Execution time is 24 millisecons
The path does not exist.
Execution time is 2 millisecons

Contributing

Papapostolou Katerina

About

CompressedSparseRows and BFS implementation using java


Languages

Language:Java 100.0%