To generate graph labels, you run:
select concat(y.reference_ID, ‘ [label=”‘, replace(regexp_replace(p1.post_title, ‘[^0-9a-zA-Z ]’, ‘ ‘), ‘ ‘, ‘ ‘), ‘”]’) ptptpt
from wp_yarpp_related_cache y
join wp_posts p1 on y.reference_id = p1.ID
where p1.post_type = ‘post’
union
select concat(y.ID, ‘ [label=”‘, replace(regexp_replace(p2.post_title, ‘[^0-9a-zA-Z ]’, ‘ ‘), ‘ ‘, ‘ ‘), ‘”]’)
from wp_yarpp_related_cache y
join wp_posts p2 on y.ID=p2.ID
where p2.post_type = ‘post’;
Then you need post connections in a DOT format, so you run:
select concat(y.reference_ID, ‘ — ‘, y.ID)
from wp_yarpp_related_cache y
join wp_posts p1 on y.reference_id = p1.ID
join wp_posts p2 on y.ID=p2.ID
where p1.post_type=’post’ and p2.post_type=’post’;
Finally you wrap it in a nice .DOT file, starting with something like:
graph {
rankdir=LR;
node [nodesep=2.0; fontsize=11; shape=box];
graph [overlap=false; splines = true;];
then your labels
then your connections
then a closing curly bracket
The last step is to process the .DOT file with GV:
sfdp ./myfile.dot -Tsvg > result.svg
Of course you can automate the entire process. Then parametrize it with post_id, or enrich the label with tags and/or categories (using “record” label type, possibly), or build a separate map for each category (rather than post), or show links between tags (for tag-heavy websites), or build a bigger map and use it as a light post background. And so on, and so forth. The sky is the limit really.
By the way, I am not a WordPress developer but am happy to help with the graphs if you ever need a hand. No strings attached.
-
This reply was modified 5 years, 2 months ago by
xpil.
-
This reply was modified 5 years, 2 months ago by
xpil.
-
This reply was modified 5 years, 2 months ago by
xpil.