Directed acyclic graph - directed-acyclic-graphs

I have problems understanding the directed acyclic graph on page 9
http://mitpress.mit.edu/books/chapters/0262033844chap27.pdf
Someone who can explain it?

If it's a general understanding you require, you could think of it this way. It's "directed" because it has a direction. "acyclic" because it goes one way. Then, think of the graph as a way to navigate one way, in a direction.
If you consider this as applied to the storage of a dictionary as an example, it can be very useful. Rather than store every single word in the dictionary as a flat text file, you could instead store them as a DAG. The benefit of this is that it takes up much less space, and can be very fast to do look ups.
So, you would store a word like "hello" as a graph made up of different letters. Each letter would be a "node". From "h" you would say ok, where do I go from here? The graph directs you to "e", and from "e" to "l" and so on.
A "graph" therefore is a method of navigation, and "directed" and "acyclic" refer to how that navigation is done.
Hope this helps. My experience of DAGs is very word specific as I implemented it for a dictionary. I hope this contributes to your understanding. If others have better understanding or if I have misrepresented anything please do comment.

Related

Detour recast tileLayer what is it about

I would like to ask how tileLayers in detour work.
Can i layer any 2 tiles resulting in "cuts" being merged into bigger holes and in what manner, are there any limitations? How many of these layers can i have and how they interact when navigating. Can i have for example basic always unchanged layer with whole map and then multiple layers with user placed geometry etc...
I'am talking about dtNavMeshCreateParams::tileLayer from original lib. There is some implementation using it in TempObstackes example. But it is not well explained (it has many custom things inside but i'am interested only in function of those layers)
Thank you in advance, i cant find much info about this online so any help would really be appreceated.
So actually i finally (many hours) found my answer to what these layers are used for:
http://digestingduck.blogspot.com/2011/02/heightfield-layer-portals.html
(btw this seems to be blog of navmesh lib author, enjoy)

QGeoPath vs QGeoPolygon

I'm trying to work out the difference between the QGeoPath and QGeoPolygon classes and the reason/purpose for their coexistence. They seem to be almost identical except QGeoPath has an additional property for "width".
Documentation is also kind of copy/paste of one another in explaining their purpose, so no gain there.
When would one use the QGeoPath vs QGeoPolygon?
Searching on the internet does not yield anything that would shed a light on this. I'm surprised not to find such Q to have been asked already.
What am I missing?
Any clarification would be much appreciated.
A path is a linear feature whereas a polygon is a closed area feature. You would use the path when you need a route and you'd use a polygon when you want an area. A path usually has a different end position to it's starting position. A path with a width does not make a polygon, just a buffer zone on either side of the centreline. They're two different concepts.

Using BFS/DFS to solve programming task

I am currently trying out Task #2 in the 2016/2017 COCI. Although I have attempted to solve this problem, I couldn't do it.
So, I looked at the solution and it said,
In order to solve this task, we need to find any path Barry can take
from the initial position to any position in the last column. We can
do this by using BFS or DFS algorithm, after which we need to
construct the path. Finally, all that’s left is to format the path
according to the task.
So I went ahead and studied the BFS and DFS algorithm. However, I am not sure how I can implement this algorithm into my program.
Although I can find certain elements in a tree with the algorithm, I don't know how to use it to find a pathway.
So can someone tell my, briefly, how to use the BFS/DFS algorithm to solve the programming problem?
Thanks in advance.
This is the contest page:
http://hsin.hr/coci/archive/2016_2017/contest1_tasks.pdf
What you could do is convert the whole map into a tree.
Here is a diagram I made to demonstrate what I exactly mean:Click here to view the image
Hope that made sense.

How to identify a separator and how to use it with a path Open Inventor

I have a few separators such as desk, lamp, and frame in my scene graph. When I add them to a separator called, "root," are they then made into nodes? Like if I wanted to use them with a path, is there an equivalent to path->containsNode for separators?
Also, is there a way to identify a separator? Let's say that I would like to place a lamp on a desk. I think the best way would be to check if the lamp collides with a specific separator like desk?
Thanks!
The class SoSeparator inherits from [SoNode][2] via SoGroup in the C++ inheritance sense. In other words, any SoSeparator* (i.e. your lamp, desk, ...) is a node. Just use any SoSeparator* anywhere it calls for a SoNode* argument and you should be good.
Do you have a good C++ book, and a copy of The Inventor Mentor on hand?

Testing if a string contains one of several thousand substrings

I'm going to be running through live twitter data and attempting to pull out tweets that mention, for example, movie titles. Assuming I have a list of ~7000 hard-coded movie titles I'd like to look against, what's the best way to select the relevant tweets? This project is in it's infancy so I'm open to any looking into any solution (i.e. language agnostic.) Any help would be greatly appreciated.
Update: I'd be curious if anyone had any insight to how the Yahoo! Placemaker API, solves this problem. It can take a text string and return a geocoded JSON result of all the locations mentioned in it.
You could try Wu and Manber's A Fast Algorithm For Multi-Pattern Searching.
The multi-pattern matching problem lies at the heart of virus scanning, so you might look to scanner implementations for inspiration. ClamAV, for example, is open source and some papers have been published describing its algorithms:
Lin, Lin and Lai: A Hybrid Algorithm of Backward Hashing and Automaton Tracking for Virus Scanning (a variant of Wu-Manber; the paper is behind the IEEE paywall).
Cha, Moraru, et al: SplitScreen: Enabling Efficient, Distributed Malware Detection
If you use compiled regular expressions, it should be pretty fast. Maybe especially if you put lots of titles in one expression.
Efficiently searching for many terms in a long character sequence would require a specialized algorithm to avoid testing for every term at every position.
But since it sounds like you have short strings with a known pattern, you should be able to use something fairly simple. Store the set of titles you care about in a hash table or tree. Parse out "string1" and "string2" from each tweet using a regex, and test whether they are contained in the set.
Working off what erickson suggested, the most feasible search is for the ("is better than" in your example), then checking for one of the 7,000 terms. You could instead narrow the set by creating 7,000 searches for "[movie] is better than" and then filtering manually on the second movie, but you'll probably hit the search rate limit pretty quickly.
You could speed up the searching by using a dedicated search service like Solr instead of using text parsing. You might be able to pull out titles quickly using some natural language processing service (OpenCalais?), but that would be better suited to batch processing.
For simultaneously searching for a large number of possible targets, the Rabin-Karp algorithm can often be useful.