+ 1

question graph

How to make a graph? and how to link it into database?

8th May 2019, 8:57 PM
Elly Razak
Elly Razak - avatar
13 Réponses
+ 3
I don't know about the graph but i know Connectivity to Mysql Database in PHP $mysqli = mysqli_connect($databaseHost, $databaseUsername, $databasePassword, $databaseName); <?php $databaseHost = 'localhost'; $databaseName = 'test'; $databaseUsername = 'root'; $databasePassword = ''; $mysqli = mysqli_connect($databaseHost, $databaseUsername, $databasePassword, $databaseName); ?>
9th May 2019, 7:26 AM
Aaditya Deshpande
Aaditya Deshpande - avatar
+ 3
Are you talking Graph as a Data structure or Graph as a Visualisation ?
9th May 2019, 8:00 AM
Aaditya Deshpande
Aaditya Deshpande - avatar
+ 3
If visualisation, then Daniel Adam sir has provided the answer to use the Neo4j. If Graph as a data structure, then you need to implement that Data structure and in database maintain a table that will have a information that which node is connected to which 2 edges? (As a graph should have a cycle) U can use "Adjacency matrix" for representing the graph or Adjacency list (depending upon requirement) simply you need to represent that data in form of a table That was a logical answer Now a another approch, Pear Structures_Graph package allows creating and manipulating graph data structures. It allows building of either directed or undirected graphs, with data and metadata stored in nodes. Make sure you install it before use as it is not default one. 😊👍
9th May 2019, 8:23 AM
Aaditya Deshpande
Aaditya Deshpande - avatar
+ 1
Have a look at Neo4j (https://neo4j.com)
9th May 2019, 7:05 AM
Daniel Adam
Daniel Adam - avatar
+ 1
Chartjs is only for visualization (draw the data to screen). Neo4j offers a clean REST API to the database and so it should be simple to integrate it. There are many examples and even the web app from Neo4j, that allows you to query and visualize the results, is Javascript, so you can look into that too.
9th May 2019, 7:14 AM
Daniel Adam
Daniel Adam - avatar
+ 1
thnk u aditya for ure response!😄
9th May 2019, 7:27 AM
Elly Razak
Elly Razak - avatar
+ 1
Both? I'm not sure anymore. :D
9th May 2019, 8:08 AM
Daniel Adam
Daniel Adam - avatar
0
what is the code to connct database?
9th May 2019, 7:07 AM
Elly Razak
Elly Razak - avatar
0
Depends on your language. I use C# with a special library and Cypher as query language.
9th May 2019, 7:08 AM
Daniel Adam
Daniel Adam - avatar
0
ouh, i use brackets to build the code and xampp for database, and i had download chartjs for the graph, but i dont know how to connect the data😭😭😭
9th May 2019, 7:10 AM
Elly Razak
Elly Razak - avatar
0
and okay, so i dont need to set any localhost only for graph right?😬
9th May 2019, 7:15 AM
Elly Razak
Elly Razak - avatar
0
Neo4j is a graph database, so you do not have to care about persistence if you work with graphs. As graphs are very powerful datastructures that are extremly fast (compared to relational databases) for querying data, it is obvious to use a GDB for persistence too.
9th May 2019, 7:24 AM
Daniel Adam
Daniel Adam - avatar
0
alright! anyway thnk u for ure response😄
9th May 2019, 7:26 AM
Elly Razak
Elly Razak - avatar