photog.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A place for your photos and banter. Photog first is our motto Please refer to the site rules before posting.

Administered by:

Server stats:

242
active users

#graphs

0 posts0 participants0 posts today
BuildMeABear.Biz LLC<p>🧶🧶 Do you <a href="https://handmade.social/tags/Crochet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Crochet</span></a> by chance? 🤔 Have you ever tried <a href="https://handmade.social/tags/MosaicCrochet" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>MosaicCrochet</span></a> ? 🤔 <a href="https://handmade.social/tags/BuildMeABear" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>BuildMeABear</span></a> .Biz LLC 🧸 has some wonderful <a href="https://handmade.social/tags/Handmade" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Handmade</span></a> <a href="https://handmade.social/tags/Digital" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Digital</span></a> <a href="https://handmade.social/tags/Instant" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Instant</span></a> <a href="https://handmade.social/tags/Download" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Download</span></a> <a href="https://handmade.social/tags/PDF" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>PDF</span></a> <a href="https://handmade.social/tags/Patterns" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Patterns</span></a> available! 📝 They come with both large and small <a href="https://handmade.social/tags/Graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Graphs</span></a> as well as the full Standard US <a href="https://handmade.social/tags/WrittenPattern" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>WrittenPattern</span></a> included! 😁 All BuildMeABear.LLC products are 100% <a href="https://handmade.social/tags/MadeInTheUSA" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>MadeInTheUSA</span></a> by a <a href="https://handmade.social/tags/Navy" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Navy</span></a> <a href="https://handmade.social/tags/Veteran" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Veteran</span></a> ! 🇺🇸 </p><p>Stop in and see what’s in the shoppers ! 🧸</p><p><a href="https://handmade.social/tags/Shop" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Shop</span></a> my <a href="https://handmade.social/tags/Etsy" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Etsy</span></a> store for these patterns and more here! 🧸👇🏽👇🏽👇🏽</p><p><a href="https://buildmeabearbizllc.etsy.com/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">buildmeabearbizllc.etsy.com/</span><span class="invisible"></span></a></p>
☮ ♥ ♬ 🧑‍💻<p>First plague, then war. </p><p>“Regardless of which measure you consult, the past year has seen a sharp increase in global <a href="https://ioc.exchange/tags/spending" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>spending</span></a> on <a href="https://ioc.exchange/tags/defence" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>defence</span></a>. Budgets totalled $2.7trn in 2024—up by 9.4% from 2023, the biggest jump since at least 1988. </p><p><a href="https://ioc.exchange/tags/Military" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Military</span></a> outlays now account for 2.5% of countries’ gdp on average, and 7.1% of government budgets. But the increase is even steeper when adjusted for purchasing power (see chart 1). With help from <a href="https://ioc.exchange/tags/PeterRobertson" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>PeterRobertson</span></a> of the <a href="https://ioc.exchange/tags/UniversityofWesternAustralia" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>UniversityofWesternAustralia</span></a>, we estimate that global <a href="https://ioc.exchange/tags/defence" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>defence</span></a> <a href="https://ioc.exchange/tags/spending" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>spending</span></a> rose by 10% in real terms.”</p><p>What got me to read the article? The notation, “$bn, log scale” graph. <a href="https://ioc.exchange/tags/Graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Graphs</span></a> shown in log <a href="https://ioc.exchange/tags/scale" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>scale</span></a>. </p><p>Meaning the economist pitch to readership is high in statistical education OR it’s from an Academic source. </p><p>&lt;<a href="https://archive.md/I8SBL" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">archive.md/I8SBL</span><span class="invisible"></span></a>&gt; / &lt;<a href="https://www.economist.com/graphic-detail/2025/05/16/how-do-countries-rank-by-military-spending" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">economist.com/graphic-detail/2</span><span class="invisible">025/05/16/how-do-countries-rank-by-military-spending</span></a>&gt; (paywall)</p>
Anisse<p>About a month ago, I was <a href="https://boitam.eu/@joachim/114325424853633229" rel="nofollow noopener" target="_blank">nerdsniped</a> by <span class="h-card" translate="no"><a href="https://boitam.eu/@joachim" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>joachim</span></a></span>, and I set foot on an adventure inside of Wikidata, data processing, visualization, and more. Read on <a href="https://anisse.astier.eu/wikidata-communes-viewer.html" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">anisse.astier.eu/wikidata-comm</span><span class="invisible">unes-viewer.html</span></a></p><p><a href="https://social.treehouse.systems/tags/wikidata" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>wikidata</span></a> <a href="https://social.treehouse.systems/tags/wikipedia" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>wikipedia</span></a> <a href="https://social.treehouse.systems/tags/communes" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>communes</span></a> <a href="https://social.treehouse.systems/tags/maplibre" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>maplibre</span></a> <a href="https://social.treehouse.systems/tags/echarts" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>echarts</span></a> <a href="https://social.treehouse.systems/tags/jq" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>jq</span></a> <a href="https://social.treehouse.systems/tags/visualization" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>visualization</span></a> <a href="https://social.treehouse.systems/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a></p>
Alexandre B A Villares 🐍<p>I hope one day (after I finish my PhD) I'll manage to read many of the wonderful books by <span class="h-card" translate="no"><a href="https://fosstodon.org/@allendowney" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>allendowney</span></a></span> I always start them an then get distracted :((((</p><p>Top of my list are </p><ul><li>Think Complexity (lot's of themes I enjoy, like <a href="https://ciberlandia.pt/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a> and <a href="https://ciberlandia.pt/tags/CellularAutomata" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CellularAutomata</span></a>) <a href="https://greenteapress.com/complexity2/html/index.html" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">greenteapress.com/complexity2/</span><span class="invisible">html/index.html</span></a></li><li>Think Stats (now on a new 3rd Edition) <a href="https://allendowney.github.io/ThinkStats/index.html" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">allendowney.github.io/ThinkSta</span><span class="invisible">ts/index.html</span></a></li></ul><p><a href="https://ciberlandia.pt/tags/Python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Python</span></a> <a href="https://ciberlandia.pt/tags/stats" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>stats</span></a> <a href="https://ciberlandia.pt/tags/simulation" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>simulation</span></a> <a href="https://ciberlandia.pt/tags/openbooks" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>openbooks</span></a></p>
It's Richie<p>Is there a way to graph trending hashtags on mastodon/the Fediverse?</p><p>What I'm interested in is to graph say my local city of <a href="https://hachyderm.io/tags/Adelaide" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Adelaide</span></a> and use that as a bit of an indicator of if <a href="https://hachyderm.io/tags/Mastodon" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Mastodon</span></a> usage and engagemement is growing locally in my town</p><p>And yes im interested in data across the fediverse or at least across a few selected servers, as I want data beyond just a single instance.</p><p>I can see this on my desktop web interface right now.. so Im guessing there *should* be a way.</p><p><a href="https://hachyderm.io/tags/GrowingMastodon" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>GrowingMastodon</span></a> <a href="https://hachyderm.io/tags/DataVisualisation" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DataVisualisation</span></a> <a href="https://hachyderm.io/tags/TrendingTopics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>TrendingTopics</span></a> <a href="https://hachyderm.io/tags/DataAnalytics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DataAnalytics</span></a> <a href="https://hachyderm.io/tags/FediverseAnalytics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>FediverseAnalytics</span></a> <a href="https://hachyderm.io/tags/GoogleTrends" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>GoogleTrends</span></a> <a href="https://hachyderm.io/tags/Graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Graphs</span></a></p>
Albert Cardona<p>Plots of a ReLU function (Rectified Linear Unit) and a ReLU tamed by tanh to keep its activation values below 1, which is far more realistic for modeling a neuron's activation function:<br><a href="https://www.desmos.com/calculator/jcx2xcgd7m" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">desmos.com/calculator/jcx2xcgd</span><span class="invisible">7m</span></a></p><p>"Desmos Studio is a Public Benefit Corporation with a goal of helping everyone learn math, love math, and grow with math."</p><p><a href="https://mathstodon.xyz/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a> <a href="https://mathstodon.xyz/tags/desmos" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>desmos</span></a> <a href="https://mathstodon.xyz/tags/plots" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>plots</span></a></p>
ErrantScience<p>See if you can work out the number of mistakes in this graph and let us know. Anyone that gets it right will be awarded special internet points. <a href="https://mas.to/tags/DataVis" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DataVis</span></a> <a href="https://mas.to/tags/Data" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Data</span></a> <a href="https://mas.to/tags/Graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Graphs</span></a></p>
Teknikal_Domain<p>SWR plot of my G5RV antenna, tuner disabled, at the end of all the coax. Markers on 80m (red), 40m (green), and 20m (blue, theoretically the design's natural resonance). NanoVNA wasn't calibrated to take all that coax out of the calculations.</p><p>Kinda neat.</p><p><a href="https://mastodon.tekdmn.me/tags/hamRadio" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>hamRadio</span></a> <a href="https://mastodon.tekdmn.me/tags/amateurRadio" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>amateurRadio</span></a> <a href="https://mastodon.tekdmn.me/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a> <a href="https://mastodon.tekdmn.me/tags/NanoVNA" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>NanoVNA</span></a></p>
Marc Trius<p>Is there a term for a graph that changes shape as it is traversed? (You could say that an edge is or isn't enabled depending on which edge was used to enter the node)</p><p><a href="https://hachyderm.io/tags/ComputerScience" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ComputerScience</span></a> <a href="https://hachyderm.io/tags/math" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>math</span></a> <a href="https://hachyderm.io/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a> <a href="https://hachyderm.io/tags/GameDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>GameDev</span></a></p>
Terence Eden’s Blog<p><strong>Graphing the connections between my blog posts</strong></p><p><a href="https://shkspr.mobi/blog/2025/01/graphing-the-connections-between-my-blog-posts/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">shkspr.mobi/blog/2025/01/graph</span><span class="invisible">ing-the-connections-between-my-blog-posts/</span></a></p><p>I love ripping off good ideas from other people's blogs. I was reading <a href="https://stuff.graves.cl/posts/2024-03-05_20_41-book-review-small-gods-by-terry-pratchett" rel="nofollow noopener" target="_blank">Alvaro Graves-Fuenzalida's blog</a> when I saw this nifty little force-directed graph:</p><p></p><p>When zoomed in, it shows the relation between posts and tags.</p><p></p><p>In this case, I can see that the posts about Small Gods and Pyramids both share the tags of Discworld, Fantasy, and Book Review. But only Small Gods has the tag of Religion.</p><p>Isn't that cool! It is a native feature of <a href="https://quartz.jzhao.xyz/features/graph-view" rel="nofollow noopener" target="_blank">Quartz's GraphView</a>. How can I build something like that for my WordPress blog?</p><p><strong>Aim</strong></p><p>Create an interactive graph which shows the relationship between a post, its links, and their tags.</p><p>It will end up looking something like this:</p><p></p><p>You can <a href="https://gitlab.com/edent/blog-theme/-/blob/master/includes/graph.php" rel="nofollow noopener" target="_blank">get the code</a> or follow along to see how it works.</p><p>This is a multi-stage process. Let's begin!</p><p><strong>What We Need</strong></p><p>When on a single Post, we need the following:</p><ul><li>The tags assigned to that Post.</li><li>Internal links back to that Post.</li><li>Internal links from that Post.</li><li>The tags assigned to links to and from that Post.</li></ul><p><strong>Tags assigned to that Post.</strong></p><p>This is pretty easy! Using the <a href="https://developer.wordpress.org/reference/functions/get_the_tag_list/" rel="nofollow noopener" target="_blank"><code>get_the_tag_list()</code> function</a> we can, unsurprisingly, get all the tags associated with a post.</p><pre><code>$post_tags_text = get_the_tag_list( "", ",", $ID );$post_tags_array = explode( "," , $post_tags_text );</code></pre><p>That just gets the list of tag names. If we want the tag IDs as well, we need to use <a href="https://developer.wordpress.org/reference/functions/get_the_tags/" rel="nofollow noopener" target="_blank">the <code>get_the_tags()</code> function</a>.</p><pre><code>$post_tags = get_the_tags($ID);$tags = array();foreach($post_tags as $tag) { $tags[$tag-&gt;term_id] = $tag-&gt;name; }</code></pre><p><strong>Backlinks</strong></p><p>Internal links back to the Post is slightly trickier. WordPress doesn't save relational information like that. Instead, we get the Post's URl and <a href="https://shkspr.mobi/blog/2023/10/displaying-internal-linkbacks-on-wordpress/" rel="nofollow noopener" target="_blank">search for that in the database</a>. Then we get the post IDs of all the posts which contain that string.</p><pre><code>// Get all the posts which link to this one, oldest first$the_query = new WP_Query( array( 's' =&gt; $search_url, 'post_type' =&gt; 'post', "posts_per_page" =&gt; "-1", "order" =&gt; "ASC" ));// Nothing to do if there are no inbound linksif ( !$the_query-&gt;have_posts() ) { return;}</code></pre><p><strong>Backlinks' Tags</strong></p><p>Once we have an array of posts which link back here, we can get their tags as above:</p><pre><code>// Loop through the postswhile ( $the_query-&gt;have_posts() ) { // Set it up $the_query-&gt;the_post(); $id = get_the_ID(); $title = esc_html( get_the_title() ); $url = get_the_permalink(); $backlink_tags_text = get_the_tag_list( "", ",", $ID ); $backlink_tags_array = explode( "," , $backlink_tags_text );}</code></pre><p><strong>Links from the Post</strong></p><p>Again, WordPress's lack of relational links is a weakness. In order to get internal links, we need to:</p><ol><li>Render the HTML using all the filters</li><li>Search for all <code>&lt;a href="…"&gt;</code></li><li>Extract the ones which start with the blog's domain</li><li>Get those posts' IDs.</li></ol><p>Rendering the content into HTML is done with:</p><pre><code>$content = apply_filters( "the_content", get_the_content( null, false, $ID ) );</code></pre><p>Searching for links is slightly more complex. The easiest way is to load the HTML into a DOMDocument, then extract all the anchors. All my blog posts start <code>/blog/YYYY</code> so I can avoid selecting links to tags, uploaded files, or other things. Your blog may be different.</p><pre><code>$dom = new DOMDocument();libxml_use_internal_errors( true ); // Suppress warnings from malformed HTML$dom-&gt;loadHTML( $content );libxml_clear_errors();$links = [];foreach ( $dom-&gt;getElementsByTagName( "a" ) as $anchor ) { $href = $anchor-&gt;getAttribute( "href" ); if (preg_match('/^https:\/\/shkspr\.mobi\/blog\/\d{4}$/', $href)) { $links[] = $href; }}</code></pre><p>The ID of each post can be found with <a href="https://developer.wordpress.org/reference/functions/url_to_postid/" rel="nofollow noopener" target="_blank">the <code>url_to_postid()</code> function</a>. That means we can re-use the earlier code to see what tags those posts have.</p><p><strong>Building a graph</strong></p><p>OK, so we have all our constituent parts. Let's build a graph!</p><p>Graphs consist of nodes (posts and tags) and edges (links between them). The exact format of the graph is going to depend on the graph library we use.</p><p>I've decided to use <a href="https://github.com/d3/d3-force?tab=readme-ov-file" rel="nofollow noopener" target="_blank">D3.js's Force Graph</a> as it is relatively simple and produces a reasonably good looking interactive SVG.</p><p>Imagine there are two blog posts and two hashtags.</p><pre><code>const nodes = [ { id: 1, label: "Blog Post 1", url: "https://example.com/post/1", group: "post" }, { id: 2, label: "Blog Post 2", url: "https://example.com/post/2", group: "post" }, { id: 3, label: "hashtag", url: "https://example.com/tag/3", group: "tag" }, { id: 4, label: "anotherHashtag", url: "https://example.com/tag/4", group: "tag" },];</code></pre><ul><li>Blog Post 1 links to Blog Post 2.</li><li>Blog Post 1 has a #hashtag.</li><li>Both 1 &amp; 2 share #anotherHashtag.</li></ul><pre><code>const links = [ { source: 1, target: 2 }, { source: 3, target: 1 }, { source: 4, target: 1 }, { source: 4, target: 2 },];</code></pre><p>Here's how to create a list of nodes and their links. You will need to edit it for your own blog's peculiarities.</p><pre><code>&lt;?php // Load WordPress environmentrequire_once( "wp-load.php" );// Set up arrays for nodes and links$nodes = array();$links = array();// ID of the Post$main_post_id = 12345;// Get the Post's details$main_post_url = get_permalink( $main_post_id );$main_post_title = get_the_title( $main_post_id );// Function to add new nodesfunction add_item_to_nodes( &amp;$nodes, $id, $label, $url, $group ) { $nodes[] = [ "id" =&gt; $id, "label" =&gt; $label, "url" =&gt; $url, "group" =&gt; $group ];}// Function to add new relationshipsfunction add_relationship( &amp;$links, $source, $target ) { $links[] = [ "source" =&gt; $source, "target" =&gt; $target ];}// Add Post to the nodesadd_item_to_nodes( $nodes, $main_post_id, $main_post_title, $main_post_url, "post" );// Get the tags of the Post$main_post_tags = get_the_tags( $main_post_id );// Add the tags as nodes, and create links to main Postforeach( $main_post_tags as $tag ) { $id = $tag-&gt;term_id; $name = $tag-&gt;name; // Add the node add_item_to_nodes( $nodes, $id, $name, "https://shkspr.mobi/blog/tag/" . $name, "tag" ); // Add the relationship add_relationship( $links, $id, $main_post_id );}// Get all the posts which link to this one, oldest first$the_query = new WP_Query( array( 's' =&gt; $main_post_url, 'post_type' =&gt; 'post', "posts_per_page" =&gt; "-1", "order" =&gt; "ASC" ));// Nothing to do if there are no inbound linksif ( $the_query-&gt;have_posts() ) { // Loop through the posts while ( $the_query-&gt;have_posts() ) { // Set up the query $the_query-&gt;the_post(); $post_id = get_the_ID(); $title = esc_html( get_the_title() ); $url = get_the_permalink(); // Add the node add_item_to_nodes( $nodes, $post_id, $title, $url, "post" ); // Add the relationship add_relationship( $links, $post_id, $main_post_id ); // Get the tags of the Post $post_tags = get_the_tags( $post_id ); // Add the tags as nodes, and create links to main Post foreach($post_tags as $tag) { $id = $tag-&gt;term_id; $name = $tag-&gt;name; // Add the node add_item_to_nodes( $nodes, $id, $name, "https://shkspr.mobi/blog/tag/" . $name, "tag" ); // Add the relationship add_relationship( $links, $id, $post_id ); } }}// Get all the internal links from this post// Render the post as HTML$content = apply_filters( "the_content", get_the_content( null, false, $ID ) );// Load it into HTML$dom = new DOMDocument();libxml_use_internal_errors( true );$dom-&gt;loadHTML( $content );libxml_clear_errors();// Get any &lt;a href="…" which starts with https://shkspr.mobi/blog/$internal_links = [];foreach ( $dom-&gt;getElementsByTagName( "a" ) as $anchor ) { $href = $anchor-&gt;getAttribute( "href" ); if (preg_match('/^https:\/\/shkspr\.mobi\/blog\/\d{4}$/', $href)) { $internal_links[] = $href; }}// Loop through the internal links, get their hashtagsforeach ( $internal_links as $url ) { $post_id = url_to_postid( $url ); // Get the Post's details $post_title = get_the_title( $id ); // Add the node add_item_to_nodes( $nodes, $post_id, $post_title, $url, "post" ); // Add the relationship add_relationship($links, $main_post_id, $post_id ); // Get the tags of the Post $post_tags = get_the_tags( $post_id ); // Add the tags as nodes, and create links to main Post foreach( $post_tags as $tag ) { $id = $tag-&gt;term_id; $name = $tag-&gt;name; // Add the node add_item_to_nodes( $nodes, $id, $name, "https://shkspr.mobi/blog/tag/" . $name, "tag" ); // Add the relationship add_relationship( $links, $id, $post_id ); }}// Deduplicate the nodes and links$nodes_unique = array_unique( $nodes, SORT_REGULAR );$links_unique = array_unique( $links, SORT_REGULAR );// Put them in the keyless format that D3 expects$nodes_output = array();$links_output = array();foreach ( $nodes_unique as $node ) { $nodes_output[] = $node;}foreach ( $links_unique as $link ) { $links_output[] = $link;}// Return the JSONecho json_encode( $nodes_output, JSON_PRETTY_PRINT );echo "\n";echo json_encode( $links_output, JSON_PRETTY_PRINT );</code></pre><p><strong>Creating a Force Directed SVG</strong></p><p>Once the data are spat out, you can include them in a web-page. Here's a basic example:</p><pre><code>&lt;!DOCTYPE html&gt;&lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt; &lt;title&gt;Force Directed Graph&lt;/title&gt; &lt;script src="https://d3js.org/d3.v7.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;svg width="800" height="600"&gt; &lt;defs&gt; &lt;marker id="arrowhead" markerWidth="10" markerHeight="7" refX="10" refY="3.5" orient="auto" fill="#999"&gt; &lt;path d="M0,0 L10,3.5 L0,7 Z"&gt;&lt;/path&gt; &lt;/marker&gt; &lt;/defs&gt; &lt;/svg&gt; &lt;script&gt;</code></pre><pre><code> const nodes = []; const links = []; const width = 800; const height = 600; const svg = d3.select("svg") .attr( "width", width ) .attr( "height", height ); const simulation = d3.forceSimulation( nodes ) .force( "link", d3.forceLink( links ).id( d =&gt; d.id ).distance( 100 ) ) .force( "charge", d3.forceManyBody().strength( -300 ) ) .force( "center", d3.forceCenter( width / 2, height / 2 ) ); // Run simulation with simple animation simulation.on("tick", () =&gt; { link .attr("x1", d =&gt; d.source.x) .attr("y1", d =&gt; d.source.y) .attr("x2", d =&gt; d.target.x) .attr("y2", d =&gt; d.target.y); node .attr("transform", d =&gt; `translate(${d.x},${d.y})`); }); // Draw links const link = svg.selectAll( ".link" ) .data(links) .enter().append("line") .attr( "stroke", "#999" ) .attr( "stroke-width", 2 ) .attr( "x1", d =&gt; d.source.x ) .attr( "y1", d =&gt; d.source.y ) .attr( "x2", d =&gt; d.target.x ) .attr( "y2", d =&gt; d.target.y ) .attr( "marker-end", "url(#arrowhead)" ); // Draw nodes const node = svg.selectAll( ".node" ) .data( nodes ) .enter().append( "g" ) .attr( "class", "node" ) .attr( "transform", d =&gt; `translate(${d.x},${d.y})` ) .call(d3.drag() // Make nodes draggable .on( "start", dragStarted ) .on( "drag", dragged ) .on( "end", dragEnded ) ); // Add hyperlink node.append("a") .attr( "xlink:href", d =&gt; d.url ) // Link to the node's URL .attr( "target", "_blank" ) // Open in a new tab .each(function (d) { const a = d3.select(this); // Different shapes for posts and tags if ( d.group === "post" ) { a.append("circle") .attr("r", 10) .attr("fill", "blue"); } else if ( d.group === "tag" ) { // White background rectangle a.append("rect") .attr("width", 20) .attr("height", 20) .attr("x", -10) .attr("y", -10) .attr("fill", "white"); // Red octothorpe a.append("path") .attr("d", "M-10,-5 H10 M-10,5 H10 M-5,-10 V10 M5,-10 V10") .attr("stroke", "red") .attr("stroke-width", 2) .attr("fill", "none"); } // Text label a.append( "text") .attr( "dy", 4 ) .attr( "x", d =&gt; ( d.group === "post" ? 12 : 14 ) ) .attr( "fill", "black" ) .style("font-size", "12px" ) .text( d.label ); }); // Standard helper functions to make nodes draggable function dragStarted( event, d ) { if ( !event.active ) simulation.alphaTarget(0.3).restart(); d.fx = d.x; d.fy = d.y; } function dragged( event, d ) { d.fx = event.x; d.fy = event.y; } function dragEnded( event, d ) { if (!event.active) simulation.alphaTarget(0); d.fx = null; d.fy = null; }</code></pre><pre><code> &lt;/script&gt; &lt;/body&gt;&lt;/html&gt;</code></pre><p><strong>Next Steps</strong></p><p>It needs a bit of cleaning up if I want to turn it into a WordPress plugin. It might be nice to make it a static SVG rather than relying on JavaScript. And the general æsthetic needs a bit of work.</p><p>Perhaps I could make it 3D like my <a href="https://shkspr.mobi/blog/2023/04/msc-dissertation-exploring-the-visualisation-of-hierarchical-cybersecurity-data-within-the-metaverse/" rel="nofollow noopener" target="_blank">MSc Dissertation</a>?</p><p>But I'm pretty happy with that for an afternoon hack!</p><p>You can <a href="https://gitlab.com/edent/blog-theme/-/blob/master/includes/graph.php" rel="nofollow noopener" target="_blank">get the code</a> if you want to play.</p><p><a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/blogging/" target="_blank">#blogging</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/graphs/" target="_blank">#graphs</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/html/" target="_blank">#HTML</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/php/" target="_blank">#php</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/wordpress/" target="_blank">#WordPress</a></p>
BigD<p>Contact energy has upgraded their app. <br>Not much changed except they now round the top of the bar graph on the usage tab.<br>Why would you round the top? My use doesn't rise up and fall off each month.<br>( December is Christmas. It'll be back to normal in Jan I said hopefully)<br><a href="https://mastodon.nz/tags/ContactEnergy" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ContactEnergy</span></a> <br><a href="https://mastodon.nz/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a></p>
Dan Drake 🦆<p>Oh, this is neat: combine the construction of the natural numbers as sets, interpret sets as trees, and use a nice graph layout algorithm: numbers are leaves!</p><p><a href="https://www.christo.sh/numbers-are-leaves/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="">christo.sh/numbers-are-leaves/</span><span class="invisible"></span></a></p><p><a href="https://mathstodon.xyz/tags/math" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>math</span></a> <a href="https://mathstodon.xyz/tags/settheory" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>settheory</span></a> <a href="https://mathstodon.xyz/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a></p>
Jocelyn<p><span class="h-card" translate="no"><a href="https://fosstodon.org/@catselbow" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>catselbow</span></a></span> </p><p>We also have 2025 = 3⁴ 5².</p><p>That could be represented by a hierarchy of <a href="https://mastodon.gougere.fr/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a>:<br>- three bipartite graphs joining n nodes to n nodes (n=3, twice, and n=5) make n² edges,<br>- the bipartite <a href="https://mastodon.gougere.fr/tags/graph" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graph</span></a> that has for nodes the edges of the n=3 graph has 3⁴ edges,<br>- taking those edges as one set of nodes, and those of the n=5 graph as another set, the bipartite graph formed with them has 2025 edges.</p><p>Who is ready to find a nice way to arrange this in the plane, and then code it?</p><p><a href="https://mastodon.gougere.fr/tags/network" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>network</span></a></p>
Thomas Roccia :verified:<p>🤓 I’ve been using Maltego Graph for a while, and it’s one of the best tools for visualizing investigations and pivoting!</p><p>One of the best feature is the use of Machines to automate pivoting and enrichment! 🤖</p><p>🔍 For example, you can create a Machine to automatically enrich an IP address with WHOIS info and then pivot through associated email addresses with a single click.</p><p>I have created a cheat sheet you can refer to when using Maltego 👇</p><p>I’m curious — how many of you have already created Maltego automation with Machines? </p><p><span class="h-card" translate="no"><a href="https://infosec.exchange/@Maltego" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>Maltego</span></a></span> <span class="h-card" translate="no"><a href="https://twtr.plus/users/maltegohq" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>maltegohq</span></a></span> <a href="https://infosec.exchange/tags/threatintel" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>threatintel</span></a> <a href="https://infosec.exchange/tags/investigation" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>investigation</span></a> <a href="https://infosec.exchange/tags/malware" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>malware</span></a> <a href="https://infosec.exchange/tags/IOCS" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>IOCS</span></a> <a href="https://infosec.exchange/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a> <a href="https://infosec.exchange/tags/maltego" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>maltego</span></a></p>
Bobsee<p><span class="h-card" translate="no"><a href="https://mastodon.social/@flexghost" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>flexghost</span></a></span> <a href="https://hachyderm.io/tags/Graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Graphs</span></a> should have the y-axis start at zero. Otherwise</p>
A.Stringer<p>"<a href="https://mstdn.social/tags/Airpollution" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Airpollution</span></a> is an unseen menace that poses a major threat to human <a href="https://mstdn.social/tags/health" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>health</span></a> and the <a href="https://mstdn.social/tags/climate" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>climate</span></a>. We have created the <a href="https://mstdn.social/tags/airquality" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>airquality</span></a> stripes, a visual tool that captures global air pollution trends, to bring this hidden threat into sharp focus."</p><p>These colourful diagrams show how air quality has changed in over 100 countries around the world since 1850<br><a href="https://theconversation.com/these-colourful-diagrams-show-how-air-quality-has-changed-in-over-100-countries-around-the-world-since-1850-237079" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">theconversation.com/these-colo</span><span class="invisible">urful-diagrams-show-how-air-quality-has-changed-in-over-100-countries-around-the-world-since-1850-237079</span></a></p><p><a href="https://mstdn.social/tags/fossilfuels" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>fossilfuels</span></a> <br><a href="https://mstdn.social/tags/netzero" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>netzero</span></a> <br><a href="https://mstdn.social/tags/visualart" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>visualart</span></a><br><a href="https://mstdn.social/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a><br><a href="https://mstdn.social/tags/climatechange" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>climatechange</span></a></p>
Albert Cardona<p>"Random line graphs and edge-attributed network inference", Lubberts et al. 2024 (Carey E. Proiebe's lab).</p><p><a href="https://arxiv.org/abs/2103.14726" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">arxiv.org/abs/2103.14726</span><span class="invisible"></span></a></p><p>"Our results demonstrate that the line graph of a stochastic block model exhibits underlying block structure ... By naturally incorporating information encoded in both vertices and edges, the random line graph improves network inference."</p><p><a href="https://arxiv.org/abs/2103.14726" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">arxiv.org/abs/2103.14726</span><span class="invisible"></span></a></p><p><a href="https://mathstodon.xyz/tags/GraphTheory" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>GraphTheory</span></a> <a href="https://mathstodon.xyz/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a> <a href="https://mathstodon.xyz/tags/SBM" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SBM</span></a> <a href="https://mathstodon.xyz/tags/StochasticBlockModels" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>StochasticBlockModels</span></a></p>
🏁⚡Omar Two Tone⚡🏁:verified:<p><a href="https://ioc.exchange/tags/Feat" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Feat</span></a>: (Factcheck Explorer Analysis Tool) to analyze information on a wide variety of queries... (if you want to be curious among the data...) 👇🧐</p><p><a href="https://feat.onrender.com/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">feat.onrender.com/</span><span class="invisible"></span></a> </p><p><a href="https://ioc.exchange/tags/data" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>data</span></a> <a href="https://ioc.exchange/tags/dataanalysis" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dataanalysis</span></a> <a href="https://ioc.exchange/tags/sources" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>sources</span></a> <a href="https://ioc.exchange/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a></p>
uxor :verified:<p><a href="https://mastodon.xyz/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a> theory stuff with <a href="https://mastodon.xyz/tags/SageMaths" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SageMaths</span></a><br>➡️ list of the neighbors of vertex x in the un-directed graph G : G.neighbors(G,x) 😀 </p><p>➡️ predecessors and successors of x in the directed graph G : 🤔 ... 😭 WTF</p>
uxor :verified:<p>Starting some <a href="https://mastodon.xyz/tags/graphs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>graphs</span></a> theory stuff with <a href="https://mastodon.xyz/tags/SageMaths" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SageMaths</span></a><br>➡️ Creating an empty un-directed graph : G=Graph() 😀 </p><p>➡️ Creating an empty directed graph : 🤔 ... G=digraphs.Circular(0) 😭 WTF </p><p>WHY ?</p>