Coder Social home page Coder Social logo

ds-to-graph's Introduction

Visual DS

Features

  • Convert Array into Graph.
  • Convert Stack(Array Implementaion) into Graph.
  • Convert Double Linked List into Graph.
  • Convert Binary Tree into Graph.
  • Convert Red Black Tree into Graph.

Usage

#include "App.hpp"

template<typename T, size_t size>
class Stack{
public:
	T pop();
  	void push(T &v);
private:
  	T data[size];
};

int main()
{
  	app = VisualDSApp(600, 800);
  	//First Create a application, set the Height and the Width of the window.
  	int arr[10];
  	auto a = app.NewArray<int, 10>(arr);
  	//Create a array
  
  	auto s = new Stack<int, 10>;
  	using Sk = Stack<int, 10>;
  	auto pS = app.NewStack<Sk,int, 10>(s->data);
  	//Create a stack by app  
  	pS->push(10);
  	app.OnRender();
  	Sleep(1000);
  	pS->pop();
  	app.OnRender();
  	//use the new stack(pS) to call stack operations, and it will impact you own stack,too.
	
	auto pL = app.NewList(head);
  	//create a double linked-list 
	pL->constructList(&head->data, &head->next, &head->prev);
	//call pL->constructList, and pass three parameters: the address of data, next, and prev.
  	//then all is done, you can call app.OnRender() to see the result.
  
	auto pT = app.NewTree(head);
	pT->constructTree(&head->key, &head->left, &head->right);
  	//similar to double linked-list type.
  	auto pT = app.NewRBTree(head);
  	pT->constructTree(&head->key, &head->left, &head->right, &head->color);
  	//the color type must be bool or int.
    return 0;
}

Environment Requirement

  • Windows Only. Because this project is base on Direct2D. Which means you have to make sure there is Direct2D on your computer.(It seems that win10 don't have to worry about this.)
  • Build succeed on VS2017, and I don't gurantee it will be successfully complied by other compliers.

Some screenshots

Binary Tree

Double Linked List

Red Black Tree

ds-to-graph's People

Contributors

jackmrzhou avatar

Watchers

 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.