Coder Social home page Coder Social logo

server's Introduction

Algorithm Visualizer

Introduction

Welcome to Algorithm Visualizer, an interactive online platform designed to bring algorithms to life through visualization. Whether you're a student, teacher, or professional, our platform provides an engaging way to explore and understand various algorithms.

GitHub contributors GitHub license

Languages and Frameworks Used

Languages

Key Features

  • Visualize algorithms from code:

    Algorithm Visualizer allows you to witness algorithms in action by visualizing code written in various programming languages. This visual approach facilitates a better understanding of algorithmic behavior..

  • Learn about Algorithms:

    Explore our collection of tutorials, articles, and videos that serve as valuable resources for learning about algorithms.

algorithms

In this repository, you'll find visualizations of algorithms showcased in the website's side menu. Contributions here directly impact the educational content available on the platform. https://github.com/algorithm-visualizer/algorithms

tracers

Explore the various visualization libraries in different programming languages. These libraries extract visualization commands from code. https://github.com/search?q=topic%3Avisualization-library+org%3Aalgorithm-visualizer&type=Repositories

Live Demo

Learning an algorithm gets much easier with visualizing it. Don't get what we mean? Check it out:

algorithm-visualizer.orgScreenshot

Contributing

Our project consists of multiple repositories, each playing a crucial role in the Algorithm Visualizer ecosystem. If you're interested in contributing, check out the guidelines for the specific repository:

  • algorithm-visualizer is a web app written in React. It contains UI components and interprets commands into visualizations. Check out the contributing guidelines.

  • server serves the web app and provides APIs that it needs on the fly. (e.g., GitHub sign in, compiling/running code, etc.)

  • algorithms contains visualizations of algorithms shown on the side menu of the website.

  • tracers.* are visualization libraries written in each supported language. They extract visualizing commands from code.

Ready to contribute? Explore the repositories and become part of the Algorithm Visualizer community!

server's People

Contributors

64json avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

server's Issues

JsTracer and algorithms.git problems, when offline

I would like to run the platform completely locally, but it seems that the server component needs an internet connection to access the algorithms in the algorithms repository and the tracer api.

I am getting the following messages in my terminal
`npm run watch

@algorithm-visualizer/[email protected] watch /home/foobar/server
NODE_ENV=development NODE_PATH=src ts-node-dev --respawn --ignore-watch node_modules --no-notify src

Ignore watch: [ 'node_modules' ]
Using ts-node version 8.2.0, typescript version 3.5.1
http: listening on port 8080
(node:19343) UnhandledPromiseRejectionWarning: Error: getaddrinfo ENOTFOUND api.github.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26)
(node:19343) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:19343) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: getaddrinfo ENOTFOUND api.github.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'api.github.com',
config: {
url: 'https://api.github.com/repos/algorithm-visualizer/tracers.cpp/releases/latest',
method: 'get',
headers: {
Accept: 'application/json, text/plain, /',
'User-Agent': 'axios/0.19.0'
},
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
params: { client_id: 'dummy', client_secret: 'dummy' },
data: undefined
},
request: <ref *1> Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
errored: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object]
},
writable: true,
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
protocol: 'https:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/repos/algorithm-visualizer/tracers.cpp/releases/latest?client_id=dummy&client_secret=dummy',
method: 'GET',
headers: [Object],
agent: undefined,
auth: undefined,
hostname: 'api.github.com',
port: null,
nativeProtocols: [Object],
pathname: '/repos/algorithm-visualizer/tracers.cpp/releases/latest',
search: '?client_id=dummy&client_secret=dummy'
},
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
_header: 'GET /repos/algorithm-visualizer/tracers.cpp/releases/latest?client_id=dummy&client_secret=dummy HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'User-Agent: axios/0.19.0\r\n' +
'Host: api.github.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
path: '/repos/algorithm-visualizer/tracers.cpp/releases/latest?client_id=dummy&client_secret=dummy',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
_redirectable: [Circular *1],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'https://api.github.com/repos/algorithm-visualizer/tracers.cpp/releases/latest?client_id=dummy&client_secret=dummy',
[Symbol(kCapture)]: false
},
response: undefined,
isAxiosError: true,
toJSON: [Function (anonymous)]
}
Error: getaddrinfo ENOTFOUND api.github.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'api.github.com',
config: {
url: 'https://api.github.com/repos/algorithm-visualizer/tracers.java/releases/latest',
method: 'get',
headers: {
Accept: 'application/json, text/plain, /',
'User-Agent': 'axios/0.19.0'
},
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
params: { client_id: 'dummy', client_secret: 'dummy' },
data: undefined
},
request: <ref *1> Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
errored: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object]
},
writable: true,
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
protocol: 'https:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/repos/algorithm-visualizer/tracers.java/releases/latest?client_id=dummy&client_secret=dummy',
method: 'GET',
headers: [Object],
agent: undefined,
auth: undefined,
hostname: 'api.github.com',
port: null,
nativeProtocols: [Object],
pathname: '/repos/algorithm-visualizer/tracers.java/releases/latest',
search: '?client_id=dummy&client_secret=dummy'
},
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
_header: 'GET /repos/algorithm-visualizer/tracers.java/releases/latest?client_id=dummy&client_secret=dummy HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'User-Agent: axios/0.19.0\r\n' +
'Host: api.github.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
path: '/repos/algorithm-visualizer/tracers.java/releases/latest?client_id=dummy&client_secret=dummy',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
_redirectable: [Circular *1],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'https://api.github.com/repos/algorithm-visualizer/tracers.java/releases/latest?client_id=dummy&client_secret=dummy',
[Symbol(kCapture)]: false
},
response: undefined,
isAxiosError: true,
toJSON: [Function (anonymous)]
}
Error: getaddrinfo ENOTFOUND api.github.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'api.github.com',
config: {
url: 'https://api.github.com/repos/algorithm-visualizer/tracers.js/releases/latest',
method: 'get',
headers: {
Accept: 'application/json, text/plain, /',
'User-Agent': 'axios/0.19.0'
},
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
params: { client_id: 'dummy', client_secret: 'dummy' },
data: undefined
},
request: <ref *1> Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
errored: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object]
},
writable: true,
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
protocol: 'https:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/repos/algorithm-visualizer/tracers.js/releases/latest?client_id=dummy&client_secret=dummy',
method: 'GET',
headers: [Object],
agent: undefined,
auth: undefined,
hostname: 'api.github.com',
port: null,
nativeProtocols: [Object],
pathname: '/repos/algorithm-visualizer/tracers.js/releases/latest',
search: '?client_id=dummy&client_secret=dummy'
},
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
_header: 'GET /repos/algorithm-visualizer/tracers.js/releases/latest?client_id=dummy&client_secret=dummy HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'User-Agent: axios/0.19.0\r\n' +
'Host: api.github.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
path: '/repos/algorithm-visualizer/tracers.js/releases/latest?client_id=dummy&client_secret=dummy',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
_redirectable: [Circular *1],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'https://api.github.com/repos/algorithm-visualizer/tracers.js/releases/latest?client_id=dummy&client_secret=dummy',
[Symbol(kCapture)]: false
},
response: undefined,
isAxiosError: true,
toJSON: [Function (anonymous)]
}
fatal: unable to access 'https://github.com/algorithm-visualizer/algorithms.git/': Could not resolve host: github.com
Error: fatal: unable to access 'https://github.com/algorithm-visualizer/algorithms.git/': Could not resolve host: github.com

at /home/foobar/server/src/utils/misc.ts:57:45
at ChildProcess.exithandler (child_process.js:309:5)
at ChildProcess.emit (events.js:305:20)
at ChildProcess.EventEmitter.emit (domain.js:483:12)
at maybeClose (internal/child_process.js:1028:16)
at Socket.<anonymous> (internal/child_process.js:443:11)
at Socket.emit (events.js:305:20)
at Socket.EventEmitter.emit (domain.js:483:12)
at Pipe.<anonymous> (net.js:667:12)

`
Which occurs after starting the server

GET /api/algorithms 304 3.757 ms - - GET /api/algorithms/greedy/dijkstras-shortest-path 304 0.848 ms - - GET /api/tracers/js/worker 304 1.597 ms - - Error: JsTracer has not been built yet. at /home/foobar/server/src/tracers/js/JsTracer.ts:21:32 at Layer.handle [as handle_request] (/home/foobar/server/node_modules/express/lib/router/layer.js:95:5) at next (/home/foobar/server/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/home/foobar/server/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/home/foobar/server/node_modules/express/lib/router/layer.js:95:5) at /home/foobar/server/node_modules/express/lib/router/index.js:281:22 at Function.process_params (/home/foobar/server/node_modules/express/lib/router/index.js:335:12) at next (/home/foobar/server/node_modules/express/lib/router/index.js:275:10) at Function.handle (/home/foobar/server/node_modules/express/lib/router/index.js:174:3) at router (/home/foobar/server/node_modules/express/lib/router/index.js:47:12) GET /api/tracers/js 500 4.074 ms - 82

Which occurs after trying to run an algorithm.

without docker

hey thanks for great tools
can we setup server without docker

Could you explain how src/tracers/js/worker.js works?

Hi, I find your awesome project recently and have started to read its code to understand how the system works.

I'm puzzled by src/tracers/js/worker.js as shown below. What is the AlgorithmVisualizer here? I can't find it elsewhere, not even in the Algorithm Visualizer repo.

const process = { env: { ALGORITHM_VISUALIZER: '1' } };
importScripts('/api/tracers/js');
const sandbox = code => {
const require = name => ({ 'algorithm-visualizer': AlgorithmVisualizer }[name]); // fake require
eval(code);
};
onmessage = e => {
const lines = e.data.split('\n').map((line, i) => line.replace(/(\.\s*delay\s*)\(\s*\)/g, `$1(${i})`));
const code = lines.join('\n');
sandbox(code);
postMessage(AlgorithmVisualizer.Commander.commands);
};

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.