Code Monkey home page Code Monkey logo

graph's Introduction

Graph

Bad implementation of Graph data type.

Forgive my bad english.

This repository contains 2 libraries:

  • graph.h;
  • DLL.h: (auxiliary library)implement doubly linked list data type;
Graph is the main library:

the reason why I'm actually sleeping really, really bad lately. It implements, more or less, graph data type and some basic functions:

  • bool addVertex(Label, Graph&);

    • add labeled vertex to graph;
  • bool addEdge(Label, Label, Weight, Graph&);

    • add edge between two labeled vertices;
  • bool isEmpty(const Graph&);

    • return true if the graph is empty;
  • int numVertices(const Graph&);

    • return the number of vertices in graph;
  • int numEdges(const Graph&);

    • return the number of edges in graph;
  • bool nodeDegree(Label, int&, const Graph&);

    • compute the Labeled vertex's degree and return it in the second parameter, unless it return false;
  • bool areAdjacent(Label, Label, const Graph&);

    • return true if two labeled vertices are adjacent;
  • void findPath(Label, Label, list::List &, int &, const Graph& g);

    • return in the second parameter a list of the path, label by label, wich leads from first label to second label, and in the third one the lenght of the path(each edge has a weight);
and some extra functions as:
  • list::List adjacentList(Label, const Graph&);
    • return all vertices adjacent to the vertex labeled "label";

UPDATE:

  • modified findPath's auxiliar function: int* dijkstra(Graph&, Label) to Label* dijkstra(Graph&, Label, Label, int&):
    • implement Dijkstra's algorithm and return an array in wich i-th element is the nearest vertex of the i-th vertex in graph. Return in 4th parameter the shortest distance between first and second Label;
  • Modified findPath's auxiliary function void findPath_aux(Graph&, Label, Label, int*, list::List&) to void findPath_aux(Graph&, Label, Label, Label*, list::List&):
    • returns in 4-th parameter the path, label by label, wich leads from first label to second label;

graph's People

Contributors

phibonacho avatar

Watchers

James Cloos 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.