Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

algorithm - Python usage of breadth-first search on social graph -


i've been reading lot of stackoverflow questions how use breadth-first search, dfs, a*, etc, question optimal usage , how implement in reality verse simulated graphs. e.g.

consider have social graph of twitter/facebook/some social networking site, me seems search algorithm work follows:

if user had 10 friends, 1 of had 2 friends , 3. search first figure out user a's friends were, have friends each of ten users. me seems bfs?

however, i'm not sure if that's way go implementing algorithm.

thanks,

for 2 cents, if you're trying traverse whole graph doesn't matter whole lot algorithm use long hits each node once. seems you're saying when note:

i'm trying traverse whole graph

this means terminology technically flawed- you're talking walking graph, not searching graph. unless you're trying search in particular, don't seem mention in question @ all.

with said, facebook , twitter different graph structures have impact on how walk them:

  1. facebook fundamentally undirected graph. if x friends y, y must friends x. (or in relationship with, or related to, etc).

  2. twitter fundamentally directed graph. if x follows y, y not have follow x.

these issues impact graph walking algorithm. quite honest, if want visit nodes, need graph? why not iterate on of them? if have nodes in data structure my_data iterable, have generator expression this:

def nodegenerator(my_data)     node in my_data:         yield node 

clearly, you'd need adjust nodegenerator internals handle how you're accessing nodes. said, graph structures implement node iterator. can create iterator anytime want things via:

 node in nodegenerator(my_data):      (do here) 

maybe i'm missing point of question here, @ present you've posed question search algorithms without search problem. due no free lunch nature of optimization , search, worth of search algorithm entirely dependent on search problem you're trying examine.

this true among same data set. after all, if searching name starts letter d, great approach sort alphabetically , binary search. if instead you're trying find everyone's degree of separation kevin bacon, you're going want , algorithm starts mr. bacon , recursively iterates on knows him , know. these both things on facebook or twitter, without specifics there's no way recommend algorithm. hence, if know nothing, iterate on list. it's else. if want optimize, cache calculations.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -