1 / 11

Graph Algorithms and Databases

Graph Algorithms and Databases. Du šan Zeleník. Common Tasks. Sorting Searching Inferring Routing. Entities and their properties. Single attribute entities Simple ordinal values Relatively easy to sort or search Low complexity Indexing Multi attribute entities

media
Download Presentation

Graph Algorithms and Databases

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GraphAlgorithms and Databases DušanZeleník

  2. Common Tasks • Sorting • Searching • Inferring • Routing

  3. Entities and their properties • Single attribute entities • Simple ordinal values • Relatively easy to sort or search • Low complexity • Indexing • Multi attribute entities • Relations among entities • Calculating distances (similarity) • Discovering properties

  4. Trees and Graphs • Tree is a graph • Balancing • Lowering the complexity ( O(log n) ) • Graph • Triplets (S - P - O) • Complex structure with properties • Polynomial compelxity ( O(n^k) )

  5. Spreading Activation • Select initial nodes and fill them with energy • Spread energy from nodes • Split energy among associated nodes • Mark nodes as already used • Do not spread if energy is under threshold • Repeat spreading until convergence

  6. Page Rank • Each node receives initial rank • Count outgoing edges C(node) • Page Rank for Node A is PR(A) = =(1- d) + d (PR(T1)/C(T1) + ... + PR(Tn)/C(Tn)) PR(A) is the PageRank of page A, PR(Ti) is the PageRankof pages Ti which link to page A, C(Ti) is the number of outbound links on page Ti d is a damping factor which can be set between 0 and 1.

  7. Neo4J Database • Java • SPARQL, cypher, gremlin • ACID • Multiplatform • Opensource • Plugins • Already implements many algorithms • REST

  8. Neo4J Hello World Node f = graphDb.createNode(); f.setProperty("message","Hello"); Node s = graphDb.createNode(); s.setProperty("message","World!"); Relationship r = f.createRelationshipTo(s, RelTypes.KNOWS ); r.delete(); f.delete(); s.delete();

  9. Neo4J Graph Algorithms PathFinder<WeightedPath> finder = GraphAlgoFactory.dijkstra( Traversal.expanderForTypes( ExampleTypes.MY_TYPE, Direction.BOTH ), "cost" ); WeightedPathpath = finder.findSinglePath( nodeA, nodeB ); path.weight();

  10. Neo4J Plugin publicclassShortestPathextendsServerPlugin{     @Description( "Findtheshortestpathbetweentwonodes." )     @PluginTarget( Node.class ) publicIterable<Path> shortestPath(@SourceNodesource,                 @Parameter( name = "target" ) Nodetarget,                 @Parameter( name = "types", optional = true ) String[] types,                 @Parameter( name = "depth", optional = true ) Integerdepth ) { Expanderexpander; if ( types == null ) expander = Traversal.expanderForAllTypes(); else { expander = Traversal.emptyExpander(); for ( int i = 0; i < types.length; i++ ) expander = expander.add( DynamicRelationshipType.withName( types[i] ) );         } PathFinder<Path> shortestPath = GraphAlgoFactory.shortestPath( expander, depth == null ? 4 : depth.intValue() ); returnshortestPath.findAllPaths( source, target );     } } curl -X POST http://localhost:7474/db/data/ext/GetAll/node/123/shortestPath \   -H "Content-Type: application/json" \   -d '{"target":"http://localhost:7474/db/data/node/456&depth=5"}'

  11. Research and Graphs • Z. Huang, W. Chung, T.-H. Ong, and H. Chen, “A graphbased recommender system for digital library,” in Proceedings of the 2nd ACM/IEEE-CS joint conference on Digital libraries, ser. JCDL ’02. New York, NY, USA: ACM, 2002,pp. 65–73. • I. Mele, F. Bonchi, and A. Gionis, “The early-adopter graph and its application to web-page recommendation.” New York, New York, USA: ACM Press, 2012, p. 1682. • S. D. Kamvar, T. H. Haveliwala, C. D. Manning, and G. H. Golub, “Extrapolation methods for accelerating pagerank computations,” in Proceedings of the 12th international conference on World Wide Web, ser. WWW ’03. New York, NY, USA: ACM, 2003, pp. 261–270. • Y. Deng, Z. Wu, C. Tang, H. Si, H. Xiong, and Z. Chen, “A Hybrid Movie Recommender Based on Ontology and Neural Networks.” Ieee, Dec. 2010, pp. 846–851. • B. Chen, J. Wang, Q. Huang, and T. Mei, “Personalized video recommendation through tripartite graph propagation.” New York, New York, USA: ACM Press, 2012, p. 1133.

More Related