Is there a legitimate reason for a USB-ethernet hardware device to have been connected to my laptop?

There was an unknown network adapter in my device manager. I found out it was for a USB-RJ45 ethernet device, which I have never even seen before. This device was not present when I bought the machine. As far as I have researched, it is not installed by any software or devices I use.

I’m concerned because there is a known vulnerability in Windows that’s exploited using these devices. A malicious person with access to the device could have stolen my credentials and logged in. (Google Usb-ethernet windows vulnerability if you don’t believe me.)

I believe the police or another malicious party exploited that vulnerability, and they used it to install a keylogger and acquire my hardware info. Is the presence of this device suspicious enough, from an information security standpoint, to support my belief? What would you do if you discovered the same on an enterprise machine?

In doubly connected edge list how to link halfedges properly

I’m working on doubly connected edge list. In the image below I need to add a new edge (consisting of halfedges $ g$ and $ h$ ). When adding a new edge we need to assign each half edge a previous and next half edges. In this example edge $ g$ would have halfedge $ f$ and $ h$ as previous and next halfedges respectively. And edge $ h$ would have halfedge $ g$ and $ a$ as previous and next halfedges respectively. If we ignore for a second them being linked to each other, $ g$ and $ h$ are linked to the pair $ f$ and $ a$ . I hope this makes sense. My question is when adding a new edge, how do we know how to choose the correct pair to link to? In this example we could link our halfedges to the pair $ a, f$ or $ c,b$ , or $ e,d$ . Do we have to resort to linear algebra, doing cross/dot product calculations to calculate what pair of halfedges to choose, based on the geometry of the edges? Am I possibly going in the completely wrong direction?

To get the potential canditates of pair of halfedges to link to, I iterate through all halfedges linked to vertex $ v$ , which here would be $ a,c,e$ and for each I find the previous halfedge which would $ f, b,d$ respectively.

enter image description here

2SAT problem testcase does not have any strongly connected components

My task is to solve the 2SAT problem.

I have read online that a good method to solve this problem would be to construct an implication graph, where each statement of the form A || B implies two edges ~A -> B and ~B -> A. Then, we can set values to each variable by finding all the strongly connected components of the graph.

However, this input is confusing to me:

 1 || 2 ~1 || 3  4 || ~2  (each line represents one or statement: ~ means "not") 

When I draw the implication graph for the above input, the graph looks like this:

~3 -> ~1 -> 2 -> 4  ~4 -> ~2 -> 1 -> 3 

The reason this confuses me is because there are no strongly connected components in this graph at all, meaning that the strongly connected component algorithm wouldn’t find any components, which means that we wouldn’t be able to set values for the variables. I don’t know if I’m misunderstanding the algorithm itself, or if I’ve drawn the graph wrong. Can somebody please help me understand my mistake?

Finding all partitions of a grid into k connected components

I am working on floor planing on small orthogonal grids. I want to partition a given $ m \times n$ grid into $ k$ (where $ k \leq nm$ , but usually $ k \ll nm$ ) connected components in all possible ways so that I can compute a fitness value for each solution and pick the best one. So far, I have the fitness evaluation at the end of the algorithm, no branch-and-bound or other type of early-termination, since the fitness computation requires the complete solution.

My current approach to listing all possible grid partitions into connected components is quite straight forward and I am wondering what optimizations can be added to avoid listing duplicate partitions? There must be a better way than what I have right now. I know the problem is NP, but I would at like to push my algorithm from brute-force to a smart and efficient approach.

Overview

For better visualization and description I will reformulate the task to an equivalent one: paint the grid cells using $ k$ colors so that each color builds a single connected component (with respect to 4-neighborhood) and of course all grid is completely painted.

My approach so far:

  1. Generate all seed scenarios. A seed scenario is a partial solution where each color is applied to a single cell only, the remaining cells are yet empty.
  2. Collect all possible solutions for each seed scenario by expanding the color regions in a DFS manner.
  3. Filter out duplicate solutions with help of a hash-table.

Seed scenarios

I generate the seed scenarios as permutations of $ k$ unique colors and $ mn-k$ void elements (without repetition of the voids). Hence, the total number is $ (nm)! / (mn-k)!$ For example, for a $ 1 \times 4$ grid and colors $ {0, 1}$ with void denoted as $ \square$ the seed scenarios are:

  • $ [0 1 \square \square]$
  • $ [0 \square 1 \square]$
  • $ [0 \square \square 1]$
  • $ [1 0 \square \square]$
  • $ [1 \square 0 \square]$
  • $ [1 \square \square 0]$
  • $ [\square 0 1 \square]$
  • $ [\square 0 \square 1]$
  • $ [\square 1 0 \square]$
  • $ [\square 1 \square 0]$
  • $ [\square \square 0 1]$
  • $ [\square \square 1 0]$

Seed growth / multicolor flood-fill

I assume the painting to be performed in a fixed ordering of the colors. The seed scenario always comes with the first color set as the current one. New solutions are generated then either by switching to the next color or by painting empty cells by the current color.

//PSEUDOCODE buffer.push(seed_scenario with current_color:=0); while(buffer not empty) {     partial_solution := buffer.pop();     if (partial_solution.available_cells.count == 0)         result.add(partial_solution);     else     {         buffer.push(partial_solution.nextColor()); //copy solution and increment color         buffer.pushAll(partial_solution.expand()); //kind-of flood-fill produces new solutions     } } 

partial_solution.expand() generates a number of new partial solutions. All of them have one additional cell colored by the current color. It examines the current region boundary and tries to paint each neighboring cell by the current color, if the cell is still void.

partial_solution.nextColor() duplicates the current partial solution but increments the current painting color.

This simple seed growth enumerates all possible solutions for the seed setup. However, a pair of different seed scenarios can produce identical solutions. There are indeed many duplicates produced. So far, I do not know how to take care of that. So I had to add the third step that filters duplicates so that the result contains only distinct solutions.

Question

I assume there should be a way to get rid of the duplicates, since that is where the efficiency suffers the most. Is it possible to merge the seeds generation with the painting stage? I started to thing about some sort of dynamic programming, but I have no clear idea yet. In 1D it would be much easier, but the 4-connectivity in a 2D grid makes the problem much harder. I tried searching for solutions or publications, but didn’t find anything useful yet. Maybe I am throwing in the wrong keywords. So any suggestions to my approach or pointers to literature are very much appreciated!

Note

I found Grid Puzzle Split Algorithm, but not sure if the answers can be adapted to my problem.

connected path in a matrix

The problem statement is :
A group of people is going for a fun trip to a city coordinated at (1,1). During their visit, a network started spreading all over the world. After knowing about the network, they decided to safely return to their home town coordinated at (n,m). Among all the paths from (1,1) to (n,m), some got in the contact with this network. They want to avoid networked paths and hence started calculating the total number of safe paths. Since it can take them a lot of time to find all the safe paths, so they have asked you to help.

You have been given a map in the form of a matrix of size n*m. Each coordinate represents a city on the map. You are required to find the total number of safe paths starting from the city (1,1) and ending at the city (n,m). You are allowed to move either right or down in a single move, that is, if you are at the city (x,y), then you can go to either(x+1,y) or (x,y+1) in a single move. You are not allowed to move outside the map.

A path is networked if the product of all the numbers in the path is divisible by X.

Input format

Note: Since the input matrix can be very large, therefore you are given only K coordinate’s values and remaining coordinates have values W.

The first line contains four space-separated integers n,m,k,w . The next k lines contain three space-separated integers x,y,v denoting the coordinate (x,y) has value v.

Output format

Print a single integer denoting the total number of safe paths modulo 10^9 +7.

my approach toward code:

  #include <iostream>   #include <string>  #include <limits>   #include <algorithm>   using namespace std;   // M x N matrix  #define M 5  #define N 5   // Naive recursive function to find the minimum cost to reach  // cell (m, n) from cell (0, 0) int findMinCost(int cost[M][N], int m, int n)  {   // base case   if (n == 0 || m == 0)     return INT_MAX;  // if we're at first cell (0, 0) if (m == 1 && n == 1)     return cost[0][0];  // include cost of the current cell in path and recur to find minimum // of the path from adjacent left cell and adjacent top cell. return min (findMinCost(cost, m - 1, n), findMinCost(cost, m, n - 1))             + cost[m - 1][n - 1];  }  // main function int main() { int cost[M][N] = {     { 4, 7, 8, 6, 4 },     { 6, 7, 3, 9, 2 },     { 3, 8, 1, 2, 4 },     { 7, 1, 7, 3, 7 },     { 2, 9, 8, 9, 3 } };  cout << "The minimum cost is " << findMinCost(cost, M, N);  return 0; } 

I am getting trouble on how to product the coordinate”s value after every move with having to give a proper matrix of size n*m. Somone please help me .

Host not connected to my router shows up in a nmap scan

After scanning my local network with nmap, this host shows up listed as a nmap result but it is the only host that shows on nmap that is not listed as a client on my router list of connected devices.

❯ nmap 192.168.0.xxx -A                                                                                                                                                                  Starting Nmap 7.80 ( https://nmap.org ) at 2020-04-21 14:33 -03 Nmap scan report for 192.168.0.xxx Host is up (0.0056s latency). Not shown: 998 closed ports PORT     STATE SERVICE VERSION 6666/tcp open  upnp    MiniUPnP 1.6 (Linksys/Belkin WiFi range extender; SDK 4.1.2.0; UPnP 1.0; MTK 2.001) |_irc-info: Unable to open connection 8888/tcp open  upnp    MiniUPnP 1.6 (Linksys/Belkin WiFi range extender; SDK 4.1.2.0; UPnP 1.0; MTK 2.001)  Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 37.47 seconds 

What exactly about this host might be causing it to show on nmap in my local network if its not connected to my router?

Efficiently finding “unfounded edges” in a strongly connected graph

I’ve encountered a problem I need to solve concerning dependency graphs. I’ve simplified it as follows:

Consider a strongly connected graph G = (V,E).

  • We define a subset of vertices S ⊆ V as source vertices.
  • We call an edge e = (a,b) unfounded if there is no simple path from any source vertex to b that includes e. In other words, all paths from a source vertex that include edge e, must include vertex b at least twice.

The problem:

  • Find all unfounded edges in G.

There are some obvious ways to solve this inefficently (e.g. a depth-first traversal for each edge in G), but I was wondering if there was any O(|E|) approach. I’ve been struggling with this for a while and I keep “almost” solving it in linear time. Perhaps that’s impossible? I have no idea what the lower bound on efficiency is, and I was hoping some readers here could help me discover some efficient approaches.

Efficiently remove nodes from a connected graph

Suppose you have a connected graph and want to remove k nodes such that the result is still connected. How could you do this efficiently?

It occurs to me that you could find any spanning tree, say by a tree search of any kind. Identify all leaves in the spanning tree, all of these can be removed without disconnecting the remaining vertices. If you have more than k leaves then you’re done, but in any tree you’re only guaranteed 2 leaves. So you may need to reiterate the process until you’ve removed k vertices.

That implies O(k) runs of a tree search. Does a more efficient algorithm exist? I don’t think you can just look for articulation points or bridge edges because removing a single vertex may suddenly make other vertices which weren’t articulation points now turn into articulation points.