Code Monkey home page Code Monkey logo

javagraphlibrary's Introduction

Graph Library Project

Requirements

Write a small graph library to create (add edges and vertices), manipulate (add/remove edges and vertices) and query (retrieve edges for vertex, determine connectivity) a graph data structure. Include automated tests for your code.

Some or all of the following features can also be implemented. If you choose not to, be prepared to describe how you would do so during the interview.

  • Allow edges to have a direction.
  • Allow edges to have labels.
  • Allow edges to have weights.
  • Allow the graph to be stored on disk or transmitted across a network.
  • Allow the graph to be manipulated and queried safely from multiple threads.
  • Find the shortest path between 2 vertices (bonus points if this uses weighted edges).

Implementation

To meet these requirements, I developed this project, a java 8 maven command-line project that creates a weighted, connected graph data structure. The graph stucture is created by reading in a .csv file in the form of edges defined as 'vertex 1, vertex 2, weight'. For example, one edge would be 'A,B,300' which represents an edge with a weighted value of 300. Two csv files are included. The advanced.csv file was used in this project. An image of this graph is included as graph.png. The graph data structure is composed of 2 hashmaps, one for the edges and one for the vertices.

The following graph functions are implemented:

1. create (add edges and vertices) the graph from data in a csv file
2. add/remove single edges 
3. add/remove single vertices
4. given a vertex, retrieve it's edges and determine it's connectivity to those edges
5. edges have labels and have weights
6. the Dijkstra shortest path algorithm has been implemented to find the shortest path between 2 vertices
7. The graph can be stored on disk or transmitted across a network through the java.io.Serializeable
       mechanism
8. A separate wrapper class called ThreadSafeGraph with synchronized methods was created to
    meet the requirement that it could be manipulated and queried safely from multiple threads.
9. A set of starter Junit tests are included. 

javagraphlibrary's People

Contributors

caweltjr avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.