+ 1
question graph
How to make a graph? and how to link it into database?
13 ответов
+ 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);
?>
+ 3
Are you talking Graph as a Data structure or Graph as a Visualisation ?
+ 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. 😊👍
+ 1
Have a look at Neo4j (https://neo4j.com)
+ 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.
+ 1
thnk u aditya for ure response!😄
+ 1
Both? I'm not sure anymore. :D
0
what is the code to connct database?
0
Depends on your language. I use C# with a special library and Cypher as query language.
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😭😭😭
0
and okay, so i dont need to set any localhost only for graph right?😬
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.
0
alright! anyway thnk u for ure response😄