GithubHelp home page GithubHelp logo

ra101 / graphical-representation-of-graphs-in-cpp Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 2.0 49 KB

A C++ program to draw a graph of, circles as vertexes and lines as edges using graphic.h

C++ 100.00%
graph draw cpp

graphical-representation-of-graphs-in-cpp's Introduction

Draw Graphs in C++

I was looking for a graphics.h project, One day my friend asked me "Did you ever come across any code which Draws the given input graph?", I replied... wait-for-it!

...4hrs later...

BAM!!!

First STL to implement graph using adjacency list representation, then using function from graphics.h and math.h we can create a graph of, circles as vertices and lines as edges.

Files can be edit according to comments given within files.

There are 2 files:

  • weighted.cpp: Adds weight in middle of edge.

  • unweighted.cpp: Does not do anything.

There are 2 options for positioning of vertices:

  • Circle: It divides 360° with number of vertices to get angular distance between each points.

  • Random: Random (x, y) coordinates.

There are 2 options for edges:

  • Directed: It add a little * to the edge towards directed vertex. (at 5/6th of the edge)
  • Undirected: Does not add any symbol.

random_weighted_undirected_graph.png

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.