Veuillez patienter...

Composant Graphvis pour Primefaces avec CytoscapeWeb: Dijkstra côté serveur


Dijkstra Example:

On "Generate Graph" click, a graph model is randomly generated on the server side and drawn on the client side.
On "Find path" click, server applies the Dijkstra algorithm looking for the shortest path. if a path is found, server applies red color to all path elements, on the client side the graph is updated and the shortest path is shown.

Cytoscape Web will replace the contents of this div with your graph.

<p:growl id="growl" />
<h:form id="dijkstraForm">	
	<div style="height:50%;width:100%; border:solid 1px; padding:2px">
		<p:messages id="messages" showDetail="true"/>
		<div id="dijGraphContainer" style="height:70%;">
			<p:graphvis id="dijGraph" title="Graphe Dijkstra" value="#{demoDijBean.graphModel}" 
				styleClass="ui-datatable ui-widget" widgetVar="graph" >
		<p:commandButton id="cmdGenerate" value="Generate Graph" action="#{demoDijBean.generateGraph()}" onsuccess="graph.synchronize(true);" update=":growl dijkstraForm:messages"/>
		<p:commandButton id="cmdFindPath" value="Find path" action="#{demoDijBean.applyDijkstra()}" onsuccess="graph.synchronize();" update=":growl dijkstraForm:messages" />